From 680e2019233c8ed17a62ce2cb2d8308b3593d977 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 5 Sep 2009 20:46:07 +0100 Subject: Fix double newline after Interrupt Seems to be an issue with Ruby system() call doing a double fork.--- Library/Homebrew/utils.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/utils.rb') diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 0dd26d49b..d01436c78 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -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 -- cgit v1.2.3