From a2ef43b2a4fa1ec7925c70d3221f4d16dacdf243 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 11 Jul 2014 20:28:17 -0500 Subject: Only compute the log file path once per call --- Library/Contributions/cmd/brew-test-bot.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Library/Contributions/cmd/brew-test-bot.rb b/Library/Contributions/cmd/brew-test-bot.rb index 27ccfe4ac..9cdaf666e 100755 --- a/Library/Contributions/cmd/brew-test-bot.rb +++ b/Library/Contributions/cmd/brew-test-bot.rb @@ -93,9 +93,11 @@ class Step start_time = Time.now + log = log_file_path + pid = fork do - STDOUT.reopen(log_file_path, "wb") - STDERR.reopen(log_file_path, "wb") + STDOUT.reopen(log, "wb") + STDERR.reopen(log, "wb") Dir.chdir(@repository) if @command.first == "git" exec(*@command) end @@ -107,12 +109,12 @@ class Step @status = success ? :passed : :failed puts_result - return unless File.exist?(log_file_path) - @output = IO.read(log_file_path) + return unless File.exist?(log) + @output = File.read(log) if has_output? and (not success or @puts_output_on_success) puts @output end - FileUtils.rm log_file_path unless ARGV.include? "--keep-logs" + FileUtils.rm(log) unless ARGV.include? "--keep-logs" end end -- cgit v1.2.3