Cache result of ARGV.verbose? on the stack

This commit is contained in:
Jack Nagel 2014-09-05 15:13:53 -05:00
parent a3409a179e
commit b9c796999b

View File

@ -493,10 +493,11 @@ class Formula
# Pretty titles the command and buffers stdout/stderr # Pretty titles the command and buffers stdout/stderr
# Throws if there's an error # Throws if there's an error
def system cmd, *args def system cmd, *args
verbose = ARGV.verbose?
# remove "boring" arguments so that the important ones are more likely to # remove "boring" arguments so that the important ones are more likely to
# be shown considering that we trim long ohai lines to the terminal width # be shown considering that we trim long ohai lines to the terminal width
pretty_args = args.dup pretty_args = args.dup
if cmd == "./configure" and not ARGV.verbose? if cmd == "./configure" and not verbose
pretty_args.delete "--disable-dependency-tracking" pretty_args.delete "--disable-dependency-tracking"
pretty_args.delete "--disable-debug" pretty_args.delete "--disable-debug"
end end
@ -511,7 +512,7 @@ class Formula
log = File.open(logfn, "w") log = File.open(logfn, "w")
log.puts Time.now, "", cmd, args, "" log.puts Time.now, "", cmd, args, ""
if ARGV.verbose? if verbose
rd, wr = IO.pipe rd, wr = IO.pipe
begin begin
pid = fork do pid = fork do
@ -538,7 +539,7 @@ class Formula
unless $?.success? unless $?.success?
log.flush log.flush
Kernel.system "/usr/bin/tail", "-n", "5", logfn unless ARGV.verbose? Kernel.system "/usr/bin/tail", "-n", "5", logfn unless verbose
log.puts log.puts
require 'cmd/config' require 'cmd/config'
Homebrew.dump_build_config(log) Homebrew.dump_build_config(log)