diff options
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/patch.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 5 | 
4 files changed, 11 insertions, 8 deletions
| diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index eef516f8e..96d3fdd09 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -222,7 +222,7 @@ class Updater      out = super      if $? && !$?.success?        $stderr.puts out -      raise ErrorDuringExecution, "Failure while executing: #{cmd}" +      raise ErrorDuringExecution.new(cmd)      end      ohai(cmd, out) if ARGV.verbose?      out diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index da48d60ca..100effdbd 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -214,7 +214,12 @@ end  class CurlDownloadStrategyError < RuntimeError; end  # 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  class ChecksumMissingError < ArgumentError; end diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index 53ea0ac6d..e1c5ad84b 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -66,8 +66,9 @@ class EmbeddedPatch    def apply      data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX) -    IO.popen("/usr/bin/patch -g 0 -f -#{strip}", "w") { |p| p.write(data) } -    raise ErrorDuringExecution, "Applying DATA patch failed" unless $?.success? +    cmd, args = "/usr/bin/patch", %W[-g 0 -f -#{strip}] +    IO.popen("#{cmd} #{args.join(" ")}", "w") { |p| p.write(data) } +    raise ErrorDuringExecution.new(cmd, args) unless $?.success?    end    def inspect diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 293fe0d06..fa2f430e3 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -127,10 +127,7 @@ end  # Kernel.system but with exceptions  def safe_system cmd, *args -  unless Homebrew.system cmd, *args -    args = args.map{ |arg| arg.to_s.gsub " ", "\\ " } * " " -    raise ErrorDuringExecution, "Failure while executing: #{cmd} #{args}" -  end +  Homebrew.system(cmd, *args) or raise ErrorDuringExecution.new(cmd, args)  end  # prints no output | 
