Call mstsc in WSL

This commit is contained in:
Stefan Scherer 2018-05-02 15:21:47 +02:00
parent 6fc2d9d82d
commit a01d68b2e0
No known key found for this signature in database
GPG Key ID: 5966AEAC37E957FA
1 changed files with 16 additions and 1 deletions

View File

@ -13,7 +13,11 @@ module VagrantPlugins
elsif Vagrant::Util::Which.which("rdesktop") elsif Vagrant::Util::Which.which("rdesktop")
"rdesktop" "rdesktop"
else else
raise Vagrant::Errors::LinuxRDPClientNotFound if Vagrant::Util::Platform.wsl?
"mstsc.exe"
else
raise Vagrant::Errors::LinuxRDPClientNotFound
end
end end
args = [] args = []
@ -30,6 +34,17 @@ module VagrantPlugins
args << "-p" << rdp_info[:password] if rdp_info[:password] args << "-p" << rdp_info[:password] if rdp_info[:password]
args += rdp_info[:extra_args] if rdp_info[:extra_args] args += rdp_info[:extra_args] if rdp_info[:extra_args]
args << "#{rdp_info[:host]}:#{rdp_info[:port]}" args << "#{rdp_info[:host]}:#{rdp_info[:port]}"
when "mstsc.exe"
# Setup password
cmdKeyArgs = [
"/add:#{rdp_info[:host]}:#{rdp_info[:port]}",
"/user:#{rdp_info[:username]}",
"/pass:#{rdp_info[:password]}",
]
Vagrant::Util::Subprocess.execute("cmdkey.exe", *cmdKeyArgs)
args = ["/v:#{rdp_info[:host]}:#{rdp_info[:port]}"]
args += rdp_info[:extra_args] if rdp_info[:extra_args]
end end
# Finally, run the client. # Finally, run the client.