Reduce branches and effective scope of some variables

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

View File

@ -513,25 +513,24 @@ class Formula
if ARGV.verbose? if ARGV.verbose?
rd, wr = IO.pipe rd, wr = IO.pipe
out = wr
else
out = log
end
begin begin
pid = fork do pid = fork do
if rd
rd.close rd.close
log.close log.close
exec_cmd(cmd, args, wr, logfn)
end end
exec_cmd(cmd, args, out, logfn) wr.close
end
wr.close if wr
while buf = rd.gets while buf = rd.gets
log.puts buf log.puts buf
puts buf puts buf
end if rd end
ensure
rd.close unless rd.closed?
end
else
pid = fork { exec_cmd(cmd, args, log, logfn) }
end
Process.wait(pid) Process.wait(pid)
@ -545,9 +544,6 @@ class Formula
Homebrew.dump_build_config(log) Homebrew.dump_build_config(log)
raise BuildError.new(self, cmd, args) raise BuildError.new(self, cmd, args)
end end
ensure
rd.close if rd && !rd.closed?
end
end end
private private