diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_io.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index a49fd0130e..9dc0debe16 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3952,4 +3952,22 @@ __END__ assert_raise(TypeError) {Marshal.dump(w)} } end + + def test_stdout_to_closed_pipe + EnvUtil.invoke_ruby(["-e", "loop {puts :ok}"], "", true, true) do + |in_p, out_p, err_p, pid| + out = out_p.gets + out_p.close + err = err_p.read + ensure + status = Process.wait2(pid)[1] + assert_equal("ok\n", out) + assert_empty(err) + assert_not_predicate(status, :success?) + if Signal.list["PIPE"] + assert_predicate(status, :signaled?) + assert_equal("PIPE", Signal.signame(status.termsig) || status.termsig) + end + end + end end |
