From c3169b56001db03171992d205b86951ea574f0e5 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Tue, 8 Sep 2009 11:14:03 -0700 Subject: [PATCH] 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'.) --- Library/Homebrew/formula.rb | 1 + Library/Homebrew/utils.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 23e71e0585..7faabbae6c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -184,6 +184,7 @@ protected end end unless $? == 0 + puts "Exit code: #{$?}" puts out raise end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 2a8dff0023..7beaba8ad3 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -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