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 | 870d0316673fdfd819c200da534d0a614415e89d (patch) | |
tree | 588b54f68128a0597d8ec747757f0a6ef072fbae | |
parent | cb20d4213d002465934119d9e00d5a5def8f4ac9 (diff) |
* 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/branches/ruby_1_9_2@28489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 15 |
2 files changed, 17 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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. + Wed Jun 30 02:37:30 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org> * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX. diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index cdde55153e..8a4533ef44 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -424,18 +424,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 |