End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem::Ext::Builder.run
run(command, results, command_name = nil, dir = Dir.pwd) { |status, results| ... }
lib/rubygems/ext/builder.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems/ext/builder.rb, line 51
def self.run(command, results, command_name = nil, dir = Dir.pwd)
verbose = Gem.configuration.really_verbose
begin
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
if verbose
puts("current directory: #{dir}")
p(command)
end
results << "current directory: #{dir}"
require "shellwords"
results << command.shelljoin
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string}
output, status = Open3.capture2e(env, *command, :chdir => dir)
if verbose
puts output
else
results << output
end
rescue => error
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
unless status.success?
results << "Building has failed. See above output for more information on the failure." if verbose
end
yield(status, results) if block_given?
unless status.success?
exit_reason =
if status.exited?
", exit code #{status.exitstatus}"
elsif status.signaled?
", uncaught signal #{status.termsig}"
end
raise Gem::InstallError, "#{command_name || class_name} failed#{exit_reason}"
end
end
No documentation available