This patches the connection instances generated for the winssh communicator so when a command is executed it is always run with powershell. This prevents inconsistencies with argument handling based on what the default shell is set to on the remote side. Since powershell is the default, environment variable template only needs to be set for powershell style. If the shell setting is updated to `cmd`, the command will be properly prefixed. Default shell has been updated to powershell, to prevent extraneous wrapping where it's not required. The `#ready?` check has also been updated to use a constant value, which is overridden within winssh as a blank command is invalid.
35 lines
883 B
Ruby
35 lines
883 B
Ruby
require File.expand_path("../../../kernel_v2/config/ssh", __FILE__)
|
|
|
|
module VagrantPlugins
|
|
module CommunicatorWinSSH
|
|
class Config < VagrantPlugins::Kernel_V2::SSHConfig
|
|
|
|
attr_accessor :upload_directory
|
|
|
|
def initialize
|
|
super
|
|
@upload_directory = UNSET_VALUE
|
|
end
|
|
|
|
def finalize!
|
|
@shell = "powershell" if @shell == UNSET_VALUE
|
|
@sudo_command = "%c" if @sudo_command == UNSET_VALUE
|
|
@upload_directory = "C:/Windows/Temp" if @upload_directory == UNSET_VALUE
|
|
if @export_command_template == UNSET_VALUE
|
|
@export_command_template = '$env:%ENV_KEY%="%ENV_VALUE%"'
|
|
end
|
|
super
|
|
end
|
|
|
|
def to_s
|
|
"WINSSH"
|
|
end
|
|
|
|
# Remove configuration options from regular SSH that are
|
|
# not used within this communicator
|
|
undef :forward_x11
|
|
undef :pty
|
|
end
|
|
end
|
|
end
|