Merge pull request #9758 from StefanScherer/wsl-rdp
Call mstsc.exe Windows RDP client in WSL
This commit is contained in:
commit
89d00f4204
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue