ruby-changes:31644
From: nobu <ko1@a...>
Date: Tue, 19 Nov 2013 23:00:44 +0900 (JST)
Subject: [ruby-changes:31644] nobu:r43724 (trunk): rubygems/util.rb: fix Gem::Util.popen
nobu 2013-11-19 23:00:31 +0900 (Tue, 19 Nov 2013) New Revision: 43724 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43724 Log: rubygems/util.rb: fix Gem::Util.popen * lib/rubygems/util.rb (Gem::Util.popen): should close open pipe to reap the child process, in 1.9 or later. fix deadlock on waiting the child process whose output is bigger than pipe buffer, in 1.8. Modified files: trunk/lib/rubygems/util.rb Index: lib/rubygems/util.rb =================================================================== --- lib/rubygems/util.rb (revision 43723) +++ lib/rubygems/util.rb (revision 43724) @@ -41,7 +41,7 @@ module Gem::Util https://github.com/ruby/ruby/blob/trunk/lib/rubygems/util.rb#L41 def self.popen *command begin - r, = IO.popen command + r, = IO.popen command, &:read rescue TypeError # ruby 1.8 only supports string command r, w = IO.pipe @@ -54,12 +54,13 @@ module Gem::Util https://github.com/ruby/ruby/blob/trunk/lib/rubygems/util.rb#L54 w.close - Process.wait pid - - r + begin + return r.read + ensure + Process.wait pid + end end - r.read end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/