diff --git a/locales/app.yml b/locales/app.yml index 838a525d..41c2197a 100644 --- a/locales/app.yml +++ b/locales/app.yml @@ -65,6 +65,16 @@ _version: 2 es: "Actualizando módulos..." fr: "Mise à jour des modules..." zh_TW: "正在更新模組..." +"Unloading modules...": + en: "Unloading modules..." + es: "Descarga de módulos..." + fr: "Déchargement des modules..." + zh_TW: "正在卸載模組..." +"Reloading modules...": + en: "Reloading modules..." + es: "Módulos de recarga..." + fr: "Modules de rechargement..." + zh_TW: "正在重裝模組..." "Powershell Modules Update": en: "Powershell Modules Update" es: "Actualización de módulos Powershell" diff --git a/src/steps/powershell.rs b/src/steps/powershell.rs index bf81b3ef..4227bfd6 100644 --- a/src/steps/powershell.rs +++ b/src/steps/powershell.rs @@ -67,21 +67,34 @@ impl Powershell { print_separator(t!("Powershell Modules Update")); - let mut cmd = vec!["Update-Module"]; + let unload_cmd = ["Get-Module | Remove-Module -Force"]; + let mut update_cmd = vec!["Update-Module"]; + let reload_cmd = ["Get-Module -ListAvailable | Import-Module"]; if ctx.config().verbose() { - cmd.push("-Verbose") + update_cmd.push("-Verbose"); } if ctx.config().yes(Step::Powershell) { - cmd.push("-Force") + update_cmd.push("-Force"); } + println!("{}", t!("Unloading modules...")); + ctx.run_type() + .execute(powershell) + .args(["-NoProfile", "-Command", &unload_cmd.join(" ")]) + .status_checked()?; + println!("{}", t!("Updating modules...")); ctx.run_type() .execute(powershell) - // This probably doesn't need `shell_words::join`. - .args(["-NoProfile", "-Command", &cmd.join(" ")]) + .args(["-NoProfile", "-Command", &update_cmd.join(" ")]) + .status_checked()?; + + println!("{}", t!("Reloading modules...")); + ctx.run_type() + .execute(powershell) + .args(["-NoProfile", "-Command", &reload_cmd.join(" ")]) .status_checked() }