lib/autobuild/subcommand.rb in autobuild-1.11.2 vs lib/autobuild/subcommand.rb in autobuild-1.12.0

- old
+ new

@@ -158,10 +158,20 @@ CONTROL_COMMAND_NOT_FOUND = 1 CONTROL_UNEXPECTED = 2 CONTROL_INTERRUPT = 3 + @transparent_mode = false + + def self.transparent_mode? + @transparent_mode + end + + def self.transparent_mode=(flag) + @transparent_mode = flag + end + # Run a subcommand and return its standard output # # The command's standard and error outputs, as well as the full command line # and an environment dump are saved in a log file in either the valure # returned by target#logdir, or Autobuild.logdir if the target does not @@ -381,18 +391,18 @@ outread.each_line do |line| line.force_encoding(options[:encoding]) line = line.chomp subcommand_output << line - if Autobuild.verbose - STDOUT.puts line - end logfile.puts line - # Do not yield the line if Autobuild.verbose is true, as it - # would mix the progress output with the actual command - # output. Assume that if the user wants the command output, - # the autobuild progress output is unnecessary - if !Autobuild.verbose && block_given? + + if Autobuild.verbose || transparent_mode? + STDOUT.puts "#{target_name}:#{phase}: #{line}" + elsif block_given? + # Do not yield + # would mix the progress output with the actual command + # output. Assume that if the user wants the command output, + # the autobuild progress output is unnecessary yield(line) end end outread.close