summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-01 02:56:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-01 02:56:28 +0000
commit044e6f12be818d6ba2f1582ec6d6177d442a9512 (patch)
tree7169f690ee55c9bad21a2864ad1e25ec425358ee /test/ruby
parent6381d498014da5dfbbdb4016a268ce30df04dad3 (diff)
win32.c: EPIPE for ERROR_NO_DATA
* win32/win32.c (rb_w32_write): writing to closed pipe fails with ERROR_NO_DATA but msvcrt maps it to EINVAL. map it to EPIPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_pipe.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_pipe.rb b/test/ruby/test_pipe.rb
index efca8f28c1..9fa42fd375 100644
--- a/test/ruby/test_pipe.rb
+++ b/test/ruby/test_pipe.rb
@@ -27,4 +27,23 @@ class TestPipe < Test::Unit::TestCase
end
end
end
+
+ def test_stdout_epipe
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ io = STDOUT
+ begin
+ save = io.dup
+ IO.popen("echo", "w", out: IO::NULL) do |f|
+ io.reopen(f)
+ Process.wait(f.pid)
+ assert_raise(Errno::EPIPE) do
+ io.print "foo\n"
+ end
+ end
+ ensure
+ io.reopen(save)
+ end
+ end;
+ end
end