Update WSL call to use bash instead of wsl command

This commit is contained in:
Federico Terzi 2020-06-14 18:01:35 +02:00
parent a7d10cbed7
commit b87e32e91d

View File

@ -34,6 +34,7 @@ pub enum Shell {
Cmd, Cmd,
Powershell, Powershell,
WSL, WSL,
WSL2,
Bash, Bash,
Sh, Sh,
} }
@ -52,6 +53,11 @@ impl Shell {
command command
}, },
Shell::WSL => { Shell::WSL => {
let mut command = Command::new("bash");
command.args(&["-c", &cmd]);
command
},
Shell::WSL2 => {
let mut command = Command::new("wsl"); let mut command = Command::new("wsl");
command.args(&["bash", "-c", &cmd]); command.args(&["bash", "-c", &cmd]);
command command
@ -79,6 +85,7 @@ impl Shell {
"cmd" => Some(Shell::Cmd), "cmd" => Some(Shell::Cmd),
"powershell" => Some(Shell::Powershell), "powershell" => Some(Shell::Powershell),
"wsl" => Some(Shell::WSL), "wsl" => Some(Shell::WSL),
"wsl2" => Some(Shell::WSL2),
"bash" => Some(Shell::Bash), "bash" => Some(Shell::Bash),
"sh" => Some(Shell::Sh), "sh" => Some(Shell::Sh),
_ => None, _ => None,