diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-13 10:41:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-13 10:41:34 +0000 |
commit | ce52ba9f3f920f4b5eb366dbc2e94f49e7333220 (patch) | |
tree | c6b68734052db12f252653820eb6738dddb9f531 /test | |
parent | 34b6932cbb22b9d02eb474365fbd364ca8cb8d5d (diff) | |
download | ruby-ce52ba9f3f920f4b5eb366dbc2e94f49e7333220.tar.gz |
io.c: copy_stream to duplex IO
* 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/trunk@56416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index c188f2cda3..fa3b3578db 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1105,6 +1105,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 |