[前][次][番号順一覧][スレッド一覧]

ruby-changes:28460

From: nobu <ko1@a...>
Date: Sun, 28 Apr 2013 12:54:41 +0900 (JST)
Subject: [ruby-changes:28460] nobu:r40512 (trunk): test_io_console.rb: investigate hang-up

nobu	2013-04-28 12:54:26 +0900 (Sun, 28 Apr 2013)

  New Revision: 40512

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40512

  Log:
    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.

  Modified files:
    trunk/test/io/console/test_io_console.rb

Index: test/io/console/test_io_console.rb
===================================================================
--- test/io/console/test_io_console.rb	(revision 40511)
+++ test/io/console/test_io_console.rb	(revision 40512)
@@ -264,14 +264,22 @@ class TestIO_Console < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L264
       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!

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]