From 8b8c374c453c76ca04256d252fd5f4c68dd8a845 Mon Sep 17 00:00:00 2001 From: sorah Date: Sun, 4 Nov 2018 15:39:00 +0000 Subject: 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 --- lib/rubygems/ext/builder.rb | 18 ++++++++++++------ 1 file 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}" -- cgit v1.2.3