diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index 8b73ccbcca..d8ab4305e2 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -22,6 +22,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # FORMULA_META_FILES = %w[README ChangeLog COPYING LICENSE COPYRIGHT AUTHORS] +PLEASE_REPORT_BUG = "#{Tty.white}Please report this bug to #{Tty.em}#{HOMEBREW_WWW}#{Tty.reset}" def __make url, name require 'formula' diff --git a/Library/Homebrew/test/unittest.rb b/Library/Homebrew/test/unittest.rb index d611ce234a..f2c5d73b20 100755 --- a/Library/Homebrew/test/unittest.rb +++ b/Library/Homebrew/test/unittest.rb @@ -7,6 +7,21 @@ ABS__FILE__=File.expand_path(__FILE__) $:.push(File.expand_path(__FILE__+'/../..')) require 'extend/pathname' + +# these are defined in global.rb, but we don't want to break our actual +# homebrew tree, and we do want to test everything :) +HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix' +HOMEBREW_REPOSITORY=HOMEBREW_PREFIX +HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" +HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" +HOMEBREW_USER_AGENT="Homebrew" +HOMEBREW_WWW='http://example.com' +MACOS_VERSION=10.6 + +(HOMEBREW_PREFIX+'Library'+'Formula').mkpath +Dir.chdir HOMEBREW_PREFIX +at_exit { HOMEBREW_PREFIX.parent.rmtree } + require 'utils' require 'hardware' require 'formula' @@ -17,19 +32,6 @@ require 'brew.h' require 'hardware' require 'update' -# these are defined in global.rb, but we don't want to break our actual -# homebrew tree, and we do want to test everything :) -HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix' -HOMEBREW_REPOSITORY=HOMEBREW_PREFIX -HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" -HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" -HOMEBREW_USER_AGENT="Homebrew" -MACOS_VERSION=10.6 - -(HOMEBREW_PREFIX+'Library'+'Formula').mkpath -Dir.chdir HOMEBREW_PREFIX -at_exit { HOMEBREW_PREFIX.parent.rmtree } - # for some reason our utils.rb safe_system behaves completely differently # during these tests. This is worrying for sure. def safe_system *args diff --git a/bin/brew b/bin/brew index 50f5aaf5b2..2040bd16ff 100755 --- a/bin/brew +++ b/bin/brew @@ -250,16 +250,22 @@ rescue SystemExit rescue Interrupt => e puts # seemingly a newline is typical exit 130 -rescue Exception => e - fatal = !(RuntimeError === e or SystemCallError === e) - +rescue BuildError => e + ohai "Backtrace" + puts e.backtrace + ohai "Environment" + dump_config + puts "Exit status: #{e.status}" onoe e - if BuildError === e or fatal - puts "#{Tty.white}Please report this bug to #{Tty.em}#{HOMEBREW_WWW}#{Tty.reset}" - dump_config - puts "Exit status: #{e.status}" if BuildError === e - end - puts e.backtrace if fatal or ARGV.debug? - + puts PLEASE_REPORT_BUG + exit 1 +rescue RuntimeError, SystemCallError => e + onoe e + puts e.backtrace if ARGV.debug? + exit 1 +rescue Exception => e + onoe e + puts PLEASE_REPORT_BUG + puts e.backtrace exit 1 end