aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-11-11 19:42:35 +0000
committerMax Howell2009-11-11 19:42:35 +0000
commit4bd32c615eedb7f0382ce17dc5622a16675ff112 (patch)
tree4725a6b9a5a877b4227ef81c02d6d6ac20ec03fc /Library
parent627034c441ccd6d38375fd94997ebf27c9282737 (diff)
downloadbrew-4bd32c615eedb7f0382ce17dc5622a16675ff112.tar.bz2
Fix system() exception showing regression
Rather than showing a backtrace that says "couldn't find command blah". Admittedly it's possible that the error will be something else, but unlikely. And this is neater. Ideally we'd push the bt through an error pipe like we do with install.rb. And I guess we'll do this eventually.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb3
-rw-r--r--Library/Homebrew/utils.rb4
2 files changed, 4 insertions, 3 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 10f1429be..5d3564476 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -226,7 +226,8 @@ protected
rd.close
$stdout.reopen wr
$stderr.reopen wr
- exec cmd, *args
+ exec(cmd, *args) rescue nil
+ exit! 1 # never gets here unless exec threw or failed
end
wr.close
out = ''
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index a96d0e2ae..8ec87b508 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -88,8 +88,8 @@ end
def safe_system cmd, *args
puts "#{cmd} #{args*' '}" if ARGV.verbose?
fork do
- trap("EXIT") {} # no bt on exit from this short-lived fork
- exit! 1 unless exec(cmd, *args)
+ exec(cmd, *args) rescue nil
+ exit! 1 # never gets here unless exec failed
end
Process.wait
raise ExecutionError.new(cmd, args, $?) unless $?.success?