diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-29 22:29:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-29 22:29:12 +0000 |
commit | 1f7eb6e7aed27b1618adf2b443be93c8eab1a395 (patch) | |
tree | 7fb7985d35dbc695cd293d05b15ca7eedf0b3ffa /test | |
parent | 14a70cf7b10fc3011eb939407c6e98d5b74920fb (diff) | |
download | ruby-1f7eb6e7aed27b1618adf2b443be93c8eab1a395.tar.gz |
* test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using
a pipe, get rid of not-well-defined behavior after the child
process terminated in pty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index faa7c5a9df..e41bdf2936 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -431,18 +431,25 @@ class TestRubyOptions < Test::Unit::TestCase end require 'timeout' result = nil - PTY.spawn(EnvUtil.rubybin) do |s, m| + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("\C-d") assert_nothing_raised('[ruby-dev:37798]') do - Timeout.timeout(3) {s.read} + result = Timeout.timeout(3) {s.read} end end - PTY.spawn(EnvUtil.rubybin) do |s, m| + s.close + assert_equal("", result, '[ruby-dev:37798]') + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("$stdin.read; p $stdin.gets\n\C-d") m.print("abc\n\C-d") m.print("zzz\n") result = s.read end - assert_match(/zzz\r\n"zzz\\n"\r\n\z/, result, '[ruby-core:30910]') + s.close + assert_equal("\"zzz\\n\"\n", result, '[ruby-core:30910]') end end |