Join command with given arguments before running exec

This resolves issues where directly passing arguments individually
to Kernel.exec causes encoding errors due to arguments being forced
command/shell encoding which is not always correct.
This commit is contained in:
Chris Roberts 2017-03-17 10:10:50 -07:00
parent c555e4b72f
commit 154c3be0d4
1 changed files with 9 additions and 1 deletions

View File

@ -40,7 +40,15 @@ module Vagrant
Process.wait(pid)
end
else
Kernel.exec(command, *args)
if Vagrant::Util::Platform.windows?
@@logger.debug("Converting command and arguments to single string for exec")
@@logger.debug("Command: `#{command.inspect}` Args: `#{args.inspect}`")
full_command = "#{command} #{args.join(" ")}"
@@logger.debug("Converted command: #{full_command}")
Kernel.exec(full_command)
else
Kernel.exec(command, *args)
end
end
rescue *rescue_from
# We retried already, raise the issue and be done