From b35c68eacc4a10459101b6f85db9cbc6a2e18efa Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Sun, 16 Apr 2017 07:59:29 -0700 Subject: [PATCH] Allow sudo wrapping but default to no-op --- plugins/communicators/winssh/communicator.rb | 5 ++++- plugins/communicators/winssh/config.rb | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/communicators/winssh/communicator.rb b/plugins/communicators/winssh/communicator.rb index 8dbe04d7d..e0ca8226b 100644 --- a/plugins/communicators/winssh/communicator.rb +++ b/plugins/communicators/winssh/communicator.rb @@ -20,7 +20,7 @@ module VagrantPlugins sudo = opts[:sudo] - @logger.info("Execute: #{command}") + @logger.info("Execute: #{command} (sudo=#{sudo.inspect})") exit_status = nil # Open the channel so we can execute or command @@ -56,6 +56,9 @@ SCRIPT upload(tfile.path, remote_name) tfile.delete + base_cmd = shell_cmd(opts.merge(shell: base_cmd)) + @logger.debug("Base SSH exec command: #{base_cmd}") + ch.exec(base_cmd) do |ch2, _| # Setup the channel callbacks so we can get data and exit status ch2.on_data do |ch3, data| diff --git a/plugins/communicators/winssh/config.rb b/plugins/communicators/winssh/config.rb index cb7ee29c6..10c6512a8 100644 --- a/plugins/communicators/winssh/config.rb +++ b/plugins/communicators/winssh/config.rb @@ -1,12 +1,14 @@ require File.expand_path("../../../kernel_v2/config/ssh", __FILE__) +# forward_x11 pty sudo_command + module VagrantPlugins module CommunicatorWinSSH class Config < VagrantPlugins::Kernel_V2::SSHConfig def finalize! @shell = "cmd" if @shell == UNSET_VALUE - @sudo_command = "cmd" if @sudo_command == UNSET_VALUE + @sudo_command = "%c" if @sudo_command == UNSET_VALUE if @export_command_template == UNSET_VALUE if @shell == "cmd" @export_command_template = 'set %ENV_KEY%="%ENV_VALUE%"'