diff options
Diffstat (limited to 'spec/ruby/core/process/wait2_spec.rb')
-rw-r--r-- | spec/ruby/core/process/wait2_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/process/wait2_spec.rb b/spec/ruby/core/process/wait2_spec.rb index 6eb7fc6d06..673d3cdb9d 100644 --- a/spec/ruby/core/process/wait2_spec.rb +++ b/spec/ruby/core/process/wait2_spec.rb @@ -33,4 +33,13 @@ describe "Process.wait2" do -> { Process.wait2 }.should raise_error(Errno::ECHILD) -> { Process.wait2 }.should raise_error(StandardError) end + + it "returns nil if the child process is still running when given the WNOHANG flag" do + IO.popen(ruby_cmd('STDIN.getbyte'), "w") do |io| + pid, status = Process.wait2(io.pid, Process::WNOHANG) + pid.should be_nil + status.should be_nil + io.write('a') + end + end end |