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
This commit is contained in:
sorah 2018-11-04 15:39:00 +00:00
Родитель 052e45f1e2
Коммит 8b8c374c45
1 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -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}"