Permalink
Browse files

When closing a popen pipe, child might already have exited

In the Puma tests a server is spawned with IO.popen and in the teardown
it explicitly uses a waitpid() when shutting down. This means when
IO#close tries to do that too, it throws an error.

In this case, we can ignore the error if the child has already
disappeared.
  • Loading branch information...
1 parent 2496403 commit 485cd0531db75215a7b1f618e7f4199a0bd45a2d @dbussink dbussink committed Nov 30, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 kernel/common/io.rb
View
@@ -1210,7 +1210,11 @@ def close
end
if @pid and @pid != 0
- Process.wait @pid
+ begin
+ Process.wait @pid
+ rescue Errno::ECHILD
+ # If the child already exited
+ end
@pid = nil
end

0 comments on commit 485cd05

Please sign in to comment.