Log exactly the array to be exec'd from system commands

* The debug message had been formatting filenames like "#<Pathname:/opt/...",
   this change will log exactly the array about to be executed
This commit is contained in:
Steven Willis 2016-03-08 11:04:52 -05:00
parent 62492c9f29
commit 34717c27ff
1 changed files with 5 additions and 3 deletions

View File

@ -4,14 +4,16 @@ require 'shellwords'
class Hbc::SystemCommand
def self.run(executable, options={})
command = _process_options(executable, options)
odebug "Executing: #{command.utf8_inspect}"
processed_stdout = ''
processed_stderr = ''
command[0] = Shellwords.shellescape(command[0]) if command.size == 1
raw_stdin, raw_stdout, raw_stderr, raw_wait_thr =
Open3.popen3(*command.map { |arg| arg.respond_to?(:to_path) ? File.absolute_path(arg) : String(arg) })
to_exec = command.map { |arg| arg.respond_to?(:to_path) ? File.absolute_path(arg) : String(arg) }
odebug "Executing: #{to_exec.utf8_inspect}"
raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = Open3.popen3(*to_exec)
if options[:input]
Array(options[:input]).each { |line| raw_stdin.puts line }