mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_io_console.rb: investigate hang-up
* test/io/console/test_io_console.rb (TestIO_Console#test_noctty): grab error outputs and stop the loop upto 3 seconds. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66c0e01220
commit
1e51f30463
1 changed files with 13 additions and 5 deletions
|
@ -264,14 +264,22 @@ class TestIO_Console < Test::Unit::TestCase
|
||||||
t2.close
|
t2.close
|
||||||
cmd = NOCTTY + [
|
cmd = NOCTTY + [
|
||||||
'--disable=gems',
|
'--disable=gems',
|
||||||
'-rio/console',
|
'-e', 'open(ARGV[0], "w") {|f|',
|
||||||
'-e', 'open(ARGV[0], "w") {|f| f.puts IO.console.inspect}',
|
'-e', 'STDOUT.reopen(f)',
|
||||||
|
'-e', 'STDERR.reopen(f)',
|
||||||
|
'-e', 'require "io/console"',
|
||||||
|
'-e', 'f.puts IO.console.inspect',
|
||||||
|
'-e', 'f.flush',
|
||||||
'-e', 'File.unlink(ARGV[1])',
|
'-e', 'File.unlink(ARGV[1])',
|
||||||
|
'-e', '}',
|
||||||
'--', t.path, t2.path]
|
'--', t.path, t2.path]
|
||||||
system(*cmd)
|
system(*cmd)
|
||||||
sleep 0.1 while File.exist?(t2.path)
|
30.times do
|
||||||
|
break unless File.exist?(t2.path)
|
||||||
|
sleep 0.1
|
||||||
|
end
|
||||||
t.open
|
t.open
|
||||||
assert_equal("nil", t.gets.chomp)
|
assert_equal("nil", t.gets(nil).chomp)
|
||||||
ensure
|
ensure
|
||||||
t.close! if t and !t.closed?
|
t.close! if t and !t.closed?
|
||||||
t2.close!
|
t2.close!
|
||||||
|
|
Loading…
Reference in a new issue