Run WSL in Topgrade if present (fix #163)

This commit is contained in:
Roey Darwish Dror
2019-06-04 09:35:29 +03:00
parent 50a0563bb4
commit 5b179d93d9
4 changed files with 29 additions and 3 deletions

View File

@@ -81,3 +81,19 @@ impl Powershell {
.check_run()
}
}
pub fn run_wsl_topgrade(run_type: RunType) -> Result<(), Error> {
let wsl = require("wsl")?;
let topgrade = Command::new(&wsl)
.args(&["bash", "-l", "which", "topgrade"])
.check_output()
.map_err(|_| ErrorKind::SkipStep)?;
print_separator("WSL");
run_type
.execute(&wsl)
.args(&["bash", "-c"])
.arg(format!("TOPGRADE_PREFIX=WSL exec {}", topgrade))
.check_run()
}