summaryrefslogtreecommitdiff
path: root/test/io/console
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-28 03:54:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-28 03:54:26 +0000
commit1e51f3046301c41e23b51aa75aa205dd14a440c0 (patch)
tree9fc0b10a1ad01eef516603b5bd20eaaf5903fe40 /test/io/console
parent66c0e01220bd2855b860fd0f7a4b9b4b64669de8 (diff)
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
Diffstat (limited to 'test/io/console')
-rw-r--r--test/io/console/test_io_console.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 65514f2b81..a9de376a2b 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -264,14 +264,22 @@ class TestIO_Console < Test::Unit::TestCase
t2.close
cmd = NOCTTY + [
'--disable=gems',
- '-rio/console',
- '-e', 'open(ARGV[0], "w") {|f| f.puts IO.console.inspect}',
- '-e', 'File.unlink(ARGV[1])',
+ '-e', 'open(ARGV[0], "w") {|f|',
+ '-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', '}',
'--', t.path, t2.path]
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
- assert_equal("nil", t.gets.chomp)
+ assert_equal("nil", t.gets(nil).chomp)
ensure
t.close! if t and !t.closed?
t2.close!