diff --git a/src/main.rs b/src/main.rs index edc5e70d..550b6792 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,7 +110,7 @@ fn run() -> Result<()> { let should_run_powershell = powershell.profile().is_some() && config.should_run(Step::Powershell); #[cfg(windows)] - runner.execute(Step::Wsl, "WSL", || windows::run_wsl_topgrade(run_type))?; + runner.execute(Step::Wsl, "WSL", || windows::run_wsl_topgrade(&ctx))?; if let Some(topgrades) = config.remote_topgrades() { for remote_topgrade in topgrades.iter().filter(|t| config.should_execute_remote(t)) { diff --git a/src/steps/os/windows.rs b/src/steps/os/windows.rs index e4e07189..bc368f54 100644 --- a/src/steps/os/windows.rs +++ b/src/steps/os/windows.rs @@ -47,18 +47,23 @@ pub fn run_scoop(cleanup: bool, run_type: RunType) -> Result<()> { Ok(()) } -pub fn run_wsl_topgrade(run_type: RunType) -> Result<()> { +pub fn run_wsl_topgrade(ctx: &ExecutionContext) -> Result<()> { let wsl = require("wsl")?; let topgrade = Command::new(&wsl) .args(&["which", "topgrade"]) .check_output() .map_err(|_| SkipStep)?; - run_type - .execute(&wsl) + let mut command = ctx.run_type().execute(&wsl); + command .args(&["bash", "-c"]) - .arg(format!("TOPGRADE_PREFIX=WSL exec {}", topgrade)) - .check_run() + .arg(format!("TOPGRADE_PREFIX=WSL exec {}", topgrade)); + + if ctx.config().yes() { + command.arg("-y"); + } + + command.check_run() } pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {