lib/autobuild/subcommand.rb in autobuild-1.2.8 vs lib/autobuild/subcommand.rb in autobuild-1.2.9
- old
+ new
@@ -25,11 +25,20 @@
puts "#{target}: running #{command.join(" ")}\n (output goes to #{logname})"
input_streams = command.collect { |o| $1 if o =~ /^\<(.+)/ }.compact
command.reject! { |o| o =~ /^\<(.+)/ }
- status = File.open(logname, "a") do |logfile|
- logfile.puts command.join(" ")
+ open_flag = if Autobuild.keep_oldlogs then 'a'
+ else 'w'
+ end
+
+ status = File.open(logname, open_flag) do |logfile|
+ if Autobuild.keep_oldlogs
+ logfile.puts
+ end
+ logfile.puts "#{Time.now}: running"
+ logfile.puts " #{command.join(" ")}"
+ logfile.puts
logfile.flush
pread, pwrite = IO.pipe # to feed subprocess stdin
cread, cwrite = IO.pipe # to control that exec goes well