* 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
This commit is contained in:
nobu 2010-06-29 22:29:12 +00:00
parent 14a70cf7b1
commit 1f7eb6e7ae
2 changed files with 17 additions and 4 deletions

View File

@ -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:30:26 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
* thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.

View File

@ -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