Display exit code when nonzero.

Brew fails if a tool (make, or whatever) doesn't return an exit code
of 0. This patch displays the non-zero code on failure, so we can
better diagnose what caused the build to fail (or if we need to add
that exit code as exception 'success code'.)
This commit is contained in:
Adam Vandenberg 2009-09-08 11:14:03 -07:00 committed by Max Howell
parent 9f07e5d9fd
commit c3169b5600
2 changed files with 5 additions and 1 deletions

View File

@ -184,6 +184,7 @@ protected
end
end
unless $? == 0
puts "Exit code: #{$?}"
puts out
raise
end

View File

@ -69,7 +69,10 @@ def safe_system cmd, *args
# CTRL-C interrupt to us too, so execution continues, but the exit code os
# still 2 so we raise our own interrupt
raise Interrupt, cmd if $?.termsig == 2
raise ExecutionError.new(cmd, args) unless exec_success and $?.success?
unless exec_success and $?.success?
puts "Exit code: #{$?}"
raise ExecutionError.new(cmd, args)
end
end
def curl url, *args