diff options
| author | Jack Nagel | 2014-09-05 15:13:52 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-09-05 15:13:52 -0500 |
| commit | effddda4f9efc336bef6e39eb93a6a9985b3ed44 (patch) | |
| tree | 7dc98ff1948b22c878030a6000b5082b8e9d05f5 | |
| parent | 479ad0265b4998531be1682d9ac96f8dec10a553 (diff) | |
| download | brew-effddda4f9efc336bef6e39eb93a6a9985b3ed44.tar.bz2 | |
Promote log stream to a local
| -rw-r--r-- | Library/Homebrew/formula.rb | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index da7f081b9..e19b70d30 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -514,33 +514,32 @@ class Formula pid = fork { exec_cmd(cmd, args, rd, wr, logfn) } wr.close - File.open(logfn, 'w') do |f| - f.puts Time.now, "", cmd, args, "" - - if ARGV.verbose? - while buf = rd.gets - f.puts buf - puts buf - end - elsif IO.respond_to?(:copy_stream) - IO.copy_stream(rd, f) - else - buf = "" - f.write(buf) while rd.read(1024, buf) + log = File.open(logfn, "w") + log.puts Time.now, "", cmd, args, "" + + if ARGV.verbose? + while buf = rd.gets + log.puts buf + puts buf end + elsif IO.respond_to?(:copy_stream) + IO.copy_stream(rd, log) + else + buf = "" + log.write(buf) while rd.read(1024, buf) + end - Process.wait(pid) + Process.wait(pid) - $stdout.flush + $stdout.flush - unless $?.success? - f.flush - Kernel.system "/usr/bin/tail", "-n", "5", logfn unless ARGV.verbose? - f.puts - require 'cmd/config' - Homebrew.dump_build_config(f) - raise BuildError.new(self, cmd, args) - end + unless $?.success? + log.flush + Kernel.system "/usr/bin/tail", "-n", "5", logfn unless ARGV.verbose? + log.puts + require 'cmd/config' + Homebrew.dump_build_config(log) + raise BuildError.new(self, cmd, args) end ensure rd.close unless rd.closed? |
