lib/packer/runner.rb in packer-config-1.6.2 vs lib/packer/runner.rb in packer-config-1.6.3

- old
+ new

@@ -6,14 +6,17 @@ class CommandExecutionError < StandardError end def self.run!(*args, quiet: false) cmd = Shellwords.shelljoin(args.flatten) + + debug = cmd.include? '-debug' + status = 0 stdout = '' stderr = '' - if quiet + if quiet && !debug # Run without streaming std* to any screen stdout, stderr, status = Open3.capture3(cmd) else # Run but stream as well as capture stdout to the screen # see: http://stackoverflow.com/a/1162850/83386 @@ -27,9 +30,13 @@ end Thread.new do until (raw_line = std_err.gets).nil? do stderr << raw_line end + end + + Thread.new do + std_in.puts $stdin.gets while thread.alive? end thread.join # don't exit until the external process is done status = thread.value end