Fix double newline after Interrupt
Seems to be an issue with Ruby system() call doing a double fork.
This commit is contained in:
parent
64e767155a
commit
680e201923
@ -23,7 +23,7 @@
|
||||
#
|
||||
class ExecutionError <RuntimeError
|
||||
def initialize cmd, args=[]
|
||||
super "#{cmd} #{args*' '}"
|
||||
super "Failure while executing: #{cmd} #{args*' '}"
|
||||
end
|
||||
end
|
||||
class BuildError <ExecutionError
|
||||
|
||||
@ -64,11 +64,12 @@ end
|
||||
# Kernel.system but with exceptions
|
||||
def safe_system cmd, *args
|
||||
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
||||
|
||||
execd=Kernel.system cmd, *args
|
||||
# somehow Ruby doesn't handle the CTRL-C from another process -- WTF!?
|
||||
exec_success=Kernel.system cmd, *args
|
||||
# some tools, eg. tar seem to confuse ruby and it doesn't propogate the
|
||||
# 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 execd and $? == 0
|
||||
raise ExecutionError.new(cmd, args) unless exec_success and $?.success?
|
||||
end
|
||||
|
||||
def curl url, *args
|
||||
|
||||
5
bin/brew
5
bin/brew
@ -210,7 +210,10 @@ rescue UsageError
|
||||
rescue SystemExit
|
||||
ohai "Kernel.exit" if ARGV.verbose?
|
||||
rescue Interrupt => e
|
||||
puts # seemingly a newline is typical
|
||||
# puts # seemingly a newline is typical
|
||||
# Above is now commented out because the system() call forks and then forks
|
||||
# again, so there are two of "us" so we get two exceptions raising and thus
|
||||
# two newlines, which buggers up the shell. FIXME!
|
||||
exit 130
|
||||
rescue SystemCallError, RuntimeError => e
|
||||
if ARGV.debug?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user