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
|
class ExecutionError <RuntimeError
|
||||||
def initialize cmd, args=[]
|
def initialize cmd, args=[]
|
||||||
super "#{cmd} #{args*' '}"
|
super "Failure while executing: #{cmd} #{args*' '}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
class BuildError <ExecutionError
|
class BuildError <ExecutionError
|
||||||
|
|||||||
@ -64,11 +64,12 @@ end
|
|||||||
# Kernel.system but with exceptions
|
# Kernel.system but with exceptions
|
||||||
def safe_system cmd, *args
|
def safe_system cmd, *args
|
||||||
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
||||||
|
exec_success=Kernel.system cmd, *args
|
||||||
execd=Kernel.system cmd, *args
|
# some tools, eg. tar seem to confuse ruby and it doesn't propogate the
|
||||||
# somehow Ruby doesn't handle the CTRL-C from another process -- WTF!?
|
# 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 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
|
end
|
||||||
|
|
||||||
def curl url, *args
|
def curl url, *args
|
||||||
|
|||||||
5
bin/brew
5
bin/brew
@ -210,7 +210,10 @@ rescue UsageError
|
|||||||
rescue SystemExit
|
rescue SystemExit
|
||||||
ohai "Kernel.exit" if ARGV.verbose?
|
ohai "Kernel.exit" if ARGV.verbose?
|
||||||
rescue Interrupt => e
|
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
|
exit 130
|
||||||
rescue SystemCallError, RuntimeError => e
|
rescue SystemCallError, RuntimeError => e
|
||||||
if ARGV.debug?
|
if ARGV.debug?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user