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

ruby-changes:19863

From: sorah <ko1@a...>
Date: Fri, 3 Jun 2011 20:48:54 +0900 (JST)
Subject: [ruby-changes:19863] sorah:r31910 (trunk): * lib/test/unit/parallel.rb: Keep $stdin, $stdout before run testcase

sorah	2011-06-03 20:48:47 +0900 (Fri, 03 Jun 2011)

  New Revision: 31910

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

  Log:
    * lib/test/unit/parallel.rb: Keep $stdin, $stdout before run testcase
      and restore after run. Because some test break $stdin, $stdout.
      Fixes [Bug #4433] [ruby-core:35353]

  Modified files:
    trunk/lib/test/unit/parallel.rb

Index: lib/test/unit/parallel.rb
===================================================================
--- lib/test/unit/parallel.rb	(revision 31909)
+++ lib/test/unit/parallel.rb	(revision 31910)
@@ -26,9 +26,11 @@
 
       def _run_suite(suite, type)
         r = report.dup
-        orig_stdout = MiniTest::Unit.output
+        orig_testout = MiniTest::Unit.output
         i,o = IO.pipe
+
         MiniTest::Unit.output = o
+        orig_stdin, orig_stdout = $stdin, $stdout
 
         th = Thread.new do
           begin
@@ -49,7 +51,9 @@
           result = [nil,nil]
         end
 
-        MiniTest::Unit.output = orig_stdout
+        MiniTest::Unit.output = orig_testout
+        $stdin = orig_stdin
+        $stdout = orig_stdout
 
         o.close
         begin
@@ -70,6 +74,8 @@
         return result
       ensure
         MiniTest::Unit.output = orig_stdout
+        $stdin = orig_stdin
+        $stdout = orig_stdout
         o.close if o && !o.closed?
         i.close if i && !i.closed?
       end

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

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