From 4450acf4ba10f97b6a5def104dd8c8530fe1ee3d Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 5 Nov 2016 03:01:30 +0000 Subject: merge revision(s) 56416: [Backport #12836] * io.c (copy_stream_body): use IO to write to copy to duplex IO. http://twitter.com/knu/status/786505317974585344 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 2b79acea09..c3cf34b799 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1090,6 +1090,18 @@ class TestIO < Test::Unit::TestCase } end + def test_copy_stream_to_duplex_io + result = IO.pipe {|a,w| + Thread.start {w.puts "yes"; w.close} + IO.popen([EnvUtil.rubybin, '-pe$_="#$.:#$_"'], "r+") {|b| + IO.copy_stream(a, b) + b.close_write + b.read + } + } + assert_equal("1:yes\n", result) + end + def ruby(*args) args = ['-e', '$>.write($<.read)'] if args.empty? ruby = EnvUtil.rubybin -- cgit v1.2.3