summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-04 15:39:00 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-04 15:39:00 +0000
commit8b8c374c453c76ca04256d252fd5f4c68dd8a845 (patch)
tree7cac98c6f86f4c3c52ac22daba61f4049aca38b9 /lib
parent052e45f1e2793d7d860c554bfb7adda43a090be2 (diff)
Fix RubyGems extension build failure after r65470
Port of upstream patch https://github.com/rubygems/rubygems/pull/2457 Since r65470 (Upstream: https://github.com/rubygems/rubygems/pull/2441), builds of extension gem had always failed under really_verbose mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/ext/builder.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 93be458cd8..54eeae57b6 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -67,12 +67,18 @@ class Gem::Ext::Builder
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
if verbose
puts("current directory: #{Dir.pwd}")
- puts(command)
- system(command)
- else
- results << "current directory: #{Dir.pwd}"
- results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
- results << IO.popen(command, "r", err: [:child, :out], &:read)
+ p(command)
+ end
+ results << "current directory: #{Dir.pwd}"
+ results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
+
+ redirections = verbose ? {} : {err: [:child, :out]}
+ IO.popen(command, "r", redirections) do |io|
+ if verbose
+ IO.copy_stream(io, $stdout)
+ else
+ results << io.read
+ end
end
rescue => error
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"