Handle CTRL-C and RuntimeErrors prettily

But not the rest
This commit is contained in:
Max Howell 2009-05-21 17:55:23 +01:00
parent 8b4f826c3c
commit ed0f997d18

View File

@ -165,10 +165,13 @@ end
# force a prettier exception handler unless --verbose or HOMEBREW_DEBUG
Kernel.at_exit {
unless ARGV.include? '--verbose' or ENV['HOMEBREW_DEBUG']
puts "\033[1;31mError\033[0;0m: #{$!}" if $!
if $! and not (ARGV.include? '--verbose' or ENV['HOMEBREW_DEBUG'])
exit! 130 if $1.class == Interrupt #control-c
if $!.kind_of? StandardError
puts "\033[1;31mError\033[0;0m: #{$!}"
exit! 1
end
end
}
########################################################################script