Only compute the log file path once per call
This commit is contained in:
parent
a7ca4bc300
commit
a2ef43b2a4
@ -93,9 +93,11 @@ class Step
|
|||||||
|
|
||||||
start_time = Time.now
|
start_time = Time.now
|
||||||
|
|
||||||
|
log = log_file_path
|
||||||
|
|
||||||
pid = fork do
|
pid = fork do
|
||||||
STDOUT.reopen(log_file_path, "wb")
|
STDOUT.reopen(log, "wb")
|
||||||
STDERR.reopen(log_file_path, "wb")
|
STDERR.reopen(log, "wb")
|
||||||
Dir.chdir(@repository) if @command.first == "git"
|
Dir.chdir(@repository) if @command.first == "git"
|
||||||
exec(*@command)
|
exec(*@command)
|
||||||
end
|
end
|
||||||
@ -107,12 +109,12 @@ class Step
|
|||||||
@status = success ? :passed : :failed
|
@status = success ? :passed : :failed
|
||||||
puts_result
|
puts_result
|
||||||
|
|
||||||
return unless File.exist?(log_file_path)
|
return unless File.exist?(log)
|
||||||
@output = IO.read(log_file_path)
|
@output = File.read(log)
|
||||||
if has_output? and (not success or @puts_output_on_success)
|
if has_output? and (not success or @puts_output_on_success)
|
||||||
puts @output
|
puts @output
|
||||||
end
|
end
|
||||||
FileUtils.rm log_file_path unless ARGV.include? "--keep-logs"
|
FileUtils.rm(log) unless ARGV.include? "--keep-logs"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user