Add quiet_system
Same as Kernel.system, but prints no output.
This commit is contained in:
parent
0a27f041d0
commit
df79d74e13
@ -84,16 +84,31 @@ def interactive_shell
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
def self.system cmd, *args
|
||||||
|
puts "#{cmd} #{args*' '}" if ARGV.verbose?
|
||||||
|
fork do
|
||||||
|
yield if block_given?
|
||||||
|
args.collect!{|arg| arg.to_s}
|
||||||
|
exec(cmd, *args) rescue nil
|
||||||
|
exit! 1 # never gets here unless exec failed
|
||||||
|
end
|
||||||
|
Process.wait
|
||||||
|
$?.success?
|
||||||
|
end
|
||||||
|
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?
|
raise ExecutionError.new(cmd, args, $?) unless Homebrew.system(cmd, *args)
|
||||||
fork do
|
end
|
||||||
args.collect!{|arg| arg.to_s}
|
|
||||||
exec(cmd, *args) rescue nil
|
# prints no output
|
||||||
exit! 1 # never gets here unless exec failed
|
def quiet_system cmd, *args
|
||||||
|
Homebrew.system(cmd, *args) do
|
||||||
|
$stdout.close
|
||||||
|
$stderr.close
|
||||||
end
|
end
|
||||||
Process.wait
|
|
||||||
raise ExecutionError.new(cmd, args, $?) unless $?.success?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl *args
|
def curl *args
|
||||||
|
Loading…
x
Reference in New Issue
Block a user