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

ruby-changes:16510

From: yugui <ko1@a...>
Date: Thu, 1 Jul 2010 11:05:30 +0900 (JST)
Subject: [ruby-changes:16510] Ruby:r28500 (ruby_1_9_2): merges r28428,r28429,r28430 and r28444 from trunk into ruby_1_9_2.

yugui	2010-07-01 11:05:10 +0900 (Thu, 01 Jul 2010)

  New Revision: 28500

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

  Log:
    merges r28428,r28429,r28430 and r28444 from trunk into ruby_1_9_2.
    --
    * test/ruby/envutil.rb (EnvUtil#invoke_ruby): get rid of possible
      deadlock.
    --
    * test/ruby/envutil.rb (EnvUtil#invoke_ruby): change the
      environment of spawned process only.
    --
    * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
      return the exit status.
    --
    * test/ruby/envutil.rb (EnvUtil#invoke_ruby): no needs to copy the
      original ENV, since it's done in spawn automatically.
      [ruby-dev:41733]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/test/ruby/envutil.rb

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28499)
+++ ruby_1_9_2/ChangeLog	(revision 28500)
@@ -1,3 +1,20 @@
+Sat Jun 26 10:08:36 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/ruby/envutil.rb (EnvUtil#invoke_ruby): no needs to copy the
+	  original ENV, since it's done in spawn automatically.
+	  [ruby-dev:41733]
+
+Fri Jun 25 10:07:14 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
+	  return the exit status.
+
+	* test/ruby/envutil.rb (EnvUtil#invoke_ruby): change the
+	  environment of spawned process only.
+
+	* test/ruby/envutil.rb (EnvUtil#invoke_ruby): get rid of possible
+	  deadlock.
+
 Wed Jun 23 23:49:21 2010  Tanaka Akira  <akr@f...>
 
 	* ext/socket/raddrinfo.c (str_is_number): renamed from str_isnumber to
Index: ruby_1_9_2/test/ruby/envutil.rb
===================================================================
--- ruby_1_9_2/test/ruby/envutil.rb	(revision 28499)
+++ ruby_1_9_2/test/ruby/envutil.rb	(revision 28500)
@@ -69,9 +69,6 @@
       in_c, in_p = IO.pipe
       out_p, out_c = IO.pipe if capture_stdout
       err_p, err_c = IO.pipe if capture_stderr
-      c = "C"
-      env = {}
-      LANG_ENVS.each {|lc| env[lc], ENV[lc] = ENV[lc], c}
       opt = opt.dup
       opt[:in] = in_c
       opt[:out] = out_c if capture_stdout
@@ -80,18 +77,21 @@
         out_p.set_encoding(enc) if out_p
         err_p.set_encoding(enc) if err_p
       end
+      c = "C"
+      child_env = {}
+      LANG_ENVS.each {|lc| child_env[lc] = c}
       case args.first
       when Hash
-        child_env = [args.shift]
+        child_env.update(args.shift)
       end
-      pid = spawn(*child_env, EnvUtil.rubybin, *args, opt)
+      pid = spawn(child_env, EnvUtil.rubybin, *args, opt)
       in_c.close
       out_c.close if capture_stdout
       err_c.close if capture_stderr
-      in_p.write stdin_data.to_str
-      in_p.close
       th_stdout = Thread.new { out_p.read } if capture_stdout
       th_stderr = Thread.new { err_p.read } if capture_stderr
+      in_p.write stdin_data.to_str
+      in_p.close
       if (!capture_stdout || th_stdout.join(10)) && (!capture_stderr || th_stderr.join(10))
         stdout = th_stdout.value if capture_stdout
         stderr = th_stderr.value if capture_stderr
@@ -103,13 +103,6 @@
       Process.wait pid
       status = $?
     ensure
-      env.each_pair {|lc, v|
-        if v
-          ENV[lc] = v
-        else
-          ENV.delete(lc)
-        end
-      } if env
       in_c.close if in_c && !in_c.closed?
       in_p.close if in_p && !in_p.closed?
       out_c.close if out_c && !out_c.closed?
@@ -205,6 +198,7 @@
           else
             assert_equal(test_stderr, stderr.lines.map {|l| l.chomp }, message)
           end
+          status
         end
       end
 

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

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