diff options
| author | Max Howell | 2009-09-05 20:46:07 +0100 |
|---|---|---|
| committer | Max Howell | 2009-09-05 20:46:07 +0100 |
| commit | 2f5bcc935a00de7188c4bbb0475fe367198cf3c7 (patch) | |
| tree | 441923fd05a1354c82fb0244bd751529dfbf8a94 /Library | |
| parent | ca9aa61815a5838fbc99bf722eb2b00ebd56d4f1 (diff) | |
| download | homebrew-2f5bcc935a00de7188c4bbb0475fe367198cf3c7.tar.bz2 | |
Fix double newline after Interrupt
Seems to be an issue with Ruby system() call doing a double fork.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index a13ed3866..55293ca80 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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 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 |
