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.
This commit is contained in:
parent
627034c441
commit
4bd32c615e
@ -226,7 +226,8 @@ protected
|
|||||||
rd.close
|
rd.close
|
||||||
$stdout.reopen wr
|
$stdout.reopen wr
|
||||||
$stderr.reopen wr
|
$stderr.reopen wr
|
||||||
exec cmd, *args
|
exec(cmd, *args) rescue nil
|
||||||
|
exit! 1 # never gets here unless exec threw or failed
|
||||||
end
|
end
|
||||||
wr.close
|
wr.close
|
||||||
out = ''
|
out = ''
|
||||||
|
|||||||
@ -88,8 +88,8 @@ end
|
|||||||
def safe_system cmd, *args
|
def safe_system cmd, *args
|
||||||
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
||||||
fork do
|
fork do
|
||||||
trap("EXIT") {} # no bt on exit from this short-lived fork
|
exec(cmd, *args) rescue nil
|
||||||
exit! 1 unless exec(cmd, *args)
|
exit! 1 # never gets here unless exec failed
|
||||||
end
|
end
|
||||||
Process.wait
|
Process.wait
|
||||||
raise ExecutionError.new(cmd, args, $?) unless $?.success?
|
raise ExecutionError.new(cmd, args, $?) unless $?.success?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user