Skip to content

Commit

Permalink
wait for the parent to read
Browse files Browse the repository at this point in the history
Spawned processes have to wait for the parent process to finish
reading from the reader-side of pipe.  If a child process exits
before the reading, `EOFError` may raise not `Errno::EAGAIN`.
http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-trunk/log/20151216T003301Z.fail.html.gz
  • Loading branch information
nobu committed Dec 16, 2015
1 parent f60ee1e commit 652d332
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shared/process/spawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@
it "closes file descriptors >= 3 in the child process" do
IO.pipe do |r, w|
begin
pid = @object.spawn(ruby_cmd(""), @options)
pid = @object.spawn(ruby_cmd("sleep"), @options)
w.close
lambda { r.read_nonblock(1) }.should raise_error(EOFError)
ensure
Expand Down Expand Up @@ -472,7 +472,7 @@
it "closes file descriptors >= 3 in the child process because they are set close_on_exec by default" do
IO.pipe do |r, w|
begin
pid = @object.spawn(ruby_cmd(""), @options)
pid = @object.spawn(ruby_cmd("sleep"), @options)
w.close
lambda { r.read_nonblock(1) }.should raise_error(EOFError)
ensure
Expand All @@ -487,7 +487,7 @@
r.close_on_exec = false
w.close_on_exec = false
begin
pid = @object.spawn(ruby_cmd(""), @options)
pid = @object.spawn(ruby_cmd("sleep"), @options)
w.close
lambda { r.read_nonblock(1) }.should raise_error(Errno::EAGAIN)
ensure
Expand Down

0 comments on commit 652d332

Please sign in to comment.