ruby-changes:16444
From: nobu <ko1@a...>
Date: Fri, 25 Jun 2010 09:59:32 +0900 (JST)
Subject: [ruby-changes:16444] Ruby:r28429 (trunk): * test/ruby/envutil.rb (EnvUtil#invoke_ruby): change the
nobu 2010-06-25 09:58:57 +0900 (Fri, 25 Jun 2010) New Revision: 28429 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28429 Log: * test/ruby/envutil.rb (EnvUtil#invoke_ruby): change the environment of spawned process only. Modified files: trunk/ChangeLog trunk/test/ruby/envutil.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 28428) +++ ChangeLog (revision 28429) @@ -1,5 +1,8 @@ -Fri Jun 25 09:56:39 2010 Nobuyoshi Nakada <nobu@r...> +Fri Jun 25 09:58:32 2010 Nobuyoshi Nakada <nobu@r...> + * 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. Index: test/ruby/envutil.rb =================================================================== --- test/ruby/envutil.rb (revision 28428) +++ test/ruby/envutil.rb (revision 28429) @@ -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,11 +77,14 @@ out_p.set_encoding(enc) if out_p err_p.set_encoding(enc) if err_p end + c = "C" + child_env = ENV.dup + 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 @@ -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? -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/