Pass command and arg list into ErrorDuringExecution constructor
This commit is contained in:
parent
7a4e2fe24d
commit
56dd575f96
@ -222,7 +222,7 @@ class Updater
|
|||||||
out = super
|
out = super
|
||||||
if $? && !$?.success?
|
if $? && !$?.success?
|
||||||
$stderr.puts out
|
$stderr.puts out
|
||||||
raise ErrorDuringExecution, "Failure while executing: #{cmd}"
|
raise ErrorDuringExecution.new(cmd)
|
||||||
end
|
end
|
||||||
ohai(cmd, out) if ARGV.verbose?
|
ohai(cmd, out) if ARGV.verbose?
|
||||||
out
|
out
|
||||||
|
|||||||
@ -214,7 +214,12 @@ end
|
|||||||
class CurlDownloadStrategyError < RuntimeError; end
|
class CurlDownloadStrategyError < RuntimeError; end
|
||||||
|
|
||||||
# raised by safe_system in utils.rb
|
# raised by safe_system in utils.rb
|
||||||
class ErrorDuringExecution < RuntimeError; end
|
class ErrorDuringExecution < RuntimeError
|
||||||
|
def initialize(cmd, args=[])
|
||||||
|
args = args.map { |a| a.to_s.gsub " ", "\\ " }.join(" ")
|
||||||
|
super "Failure while executing: #{cmd} #{args}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# raised by Pathname#verify_checksum when "expected" is nil or empty
|
# raised by Pathname#verify_checksum when "expected" is nil or empty
|
||||||
class ChecksumMissingError < ArgumentError; end
|
class ChecksumMissingError < ArgumentError; end
|
||||||
|
|||||||
@ -66,8 +66,9 @@ class EmbeddedPatch
|
|||||||
|
|
||||||
def apply
|
def apply
|
||||||
data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX)
|
data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX)
|
||||||
IO.popen("/usr/bin/patch -g 0 -f -#{strip}", "w") { |p| p.write(data) }
|
cmd, args = "/usr/bin/patch", %W[-g 0 -f -#{strip}]
|
||||||
raise ErrorDuringExecution, "Applying DATA patch failed" unless $?.success?
|
IO.popen("#{cmd} #{args.join(" ")}", "w") { |p| p.write(data) }
|
||||||
|
raise ErrorDuringExecution.new(cmd, args) unless $?.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
|
|||||||
@ -127,10 +127,7 @@ end
|
|||||||
|
|
||||||
# Kernel.system but with exceptions
|
# Kernel.system but with exceptions
|
||||||
def safe_system cmd, *args
|
def safe_system cmd, *args
|
||||||
unless Homebrew.system cmd, *args
|
Homebrew.system(cmd, *args) or raise ErrorDuringExecution.new(cmd, args)
|
||||||
args = args.map{ |arg| arg.to_s.gsub " ", "\\ " } * " "
|
|
||||||
raise ErrorDuringExecution, "Failure while executing: #{cmd} #{args}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# prints no output
|
# prints no output
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user