method
run
v2_6_3 -
Show latest stable
- Class:
Gem::Ext::Builder
run(command, results, command_name = nil)public
No documentation available.
# File lib/rubygems/ext/builder.rb, line 63
def self.run(command, results, command_name = nil)
verbose = Gem.configuration.really_verbose
begin
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
if verbose
puts("current directory: #{Dir.pwd}")
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}"
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
unless $?.success?
results << "Building has failed. See above output for more information on the failure." if verbose
exit_reason =
if $?.exited?
", exit code #{$?.exitstatus}"
elsif $?.signaled?
", uncaught signal #{$?.termsig}"
end
raise Gem::InstallError, "#{command_name || class_name} failed#{exit_reason}"
end
end