aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2009-11-06 17:06:12 +0000
committerMax Howell2009-11-07 18:22:36 +0000
commit1e879eaee8815eebd3bc3f5318f62d1e86b4d62a (patch)
tree2ef5b9b6507c4d763c425c5e125bd337a2d0283b /Library/Homebrew
parent0ec10c68ca93c86c61463349e455cd4179b64e16 (diff)
downloadbrew-1e879eaee8815eebd3bc3f5318f62d1e86b4d62a.tar.bz2
Propagate exit status in ExecutioError exception
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/formula.rb2
-rw-r--r--Library/Homebrew/global.rb5
-rw-r--r--Library/Homebrew/utils.rb8
3 files changed, 7 insertions, 8 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 6dca1faa2..0cf351ba2 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -235,7 +235,7 @@ protected
end
end
rescue
- raise BuildError.new(cmd, args)
+ raise BuildError.new(cmd, args, $?)
end
private
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 946ce6669..8b9aba4b2 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -57,8 +57,11 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY
class ExecutionError <RuntimeError
- def initialize cmd, args=[]
+ attr :status
+
+ def initialize cmd, args=[], status=nil
super "Failure while executing: #{cmd} #{args*' '}"
+ @status = status
end
end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 398119945..0f94cce6e 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -86,13 +86,10 @@ def safe_system cmd, *args
puts "#{cmd} #{args*' '}" if ARGV.verbose?
exec_success = Kernel.system cmd, *args
# some tools, eg. tar seem to confuse ruby and it doesn't propogate the
- # CTRL-C interrupt to us too, so execution continues, but the exit code os
+ # CTRL-C interrupt to us too, so execution continues, but the exit code is
# still 2 so we raise our own interrupt
raise Interrupt, cmd if $?.termsig == 2
- unless exec_success
- puts "Exit code: #{$?}"
- raise ExecutionError.new(cmd, args)
- end
+ raise ExecutionError.new(cmd, args, $?) unless exec_success
end
def curl *args
@@ -146,7 +143,6 @@ def arch_for_command cmd
return archs
end
-
# replaces before with after for the file path
def inreplace path, before, after
f = File.open(path, 'r')