diff options
Diffstat (limited to 'lib/rubygems/util.rb')
-rw-r--r-- | lib/rubygems/util.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index af53e599b5..42663974a5 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -40,27 +40,24 @@ module Gem::Util # for a command. def self.popen *command - begin - r, = IO.popen command, &:read - rescue TypeError # ruby 1.8 only supports string command - r, w = IO.pipe + IO.popen command, &:read + rescue TypeError # ruby 1.8 only supports string command + r, w = IO.pipe - pid = fork do - STDIN.close - STDOUT.reopen w + pid = fork do + STDIN.close + STDOUT.reopen w - exec(*command) - end + exec(*command) + end - w.close + w.close - begin - return r.read - ensure - Process.wait pid - end + begin + return r.read + ensure + Process.wait pid end - end end |