More tweaking of main exception handler output

This commit is contained in:
Max Howell 2009-11-12 01:33:14 +00:00
parent 6488212a54
commit 00e227ac46
3 changed files with 32 additions and 23 deletions

View File

@ -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'

View File

@ -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

View File

@ -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