Skip to content

Commit

Permalink
Add failing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 24, 2024
1 parent 44a155c commit 4434051
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion test/io/event/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def transfer
end

expect(events).to be == [:process_finished]
expect(result.success?).to be == true
expect(result).to be(:success?)
end

it "can wait for a process to terminate" do
Expand All @@ -581,6 +581,35 @@ def transfer
expect(events).to be == [:process_finished]
expect(result).to be(:success?)
end

it "can wait for a process which never starts" do
# No fork.
skip_if_ruby_platform(/mswin/)

result = nil
events = []

fiber = Fiber.new do
pid = ::Process.fork do
Fiber.blocking do
exit(-1)
end
end

result = selector.process_wait(Fiber.current, pid, 0)
expect(result).not.to be(:success?)
events << :process_finished
end

fiber.transfer

while fiber.alive?
selector.select(1)
end

expect(events).to be == [:process_finished]
expect(result).not.to be(:success?)
end
end

with "#resume" do
Expand Down

0 comments on commit 4434051

Please sign in to comment.