diff --git a/test/io/event/selector.rb b/test/io/event/selector.rb index 1d9da05..8348cf7 100644 --- a/test/io/event/selector.rb +++ b/test/io/event/selector.rb @@ -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 @@ -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