From e0c294bd9e559ae0c71b45d31761cd7857fdeab4 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Wed, 27 Nov 2019 22:19:30 +0200 Subject: [PATCH] Run Windows update specifically in the Windows powershell --- src/main.rs | 2 +- src/steps/powershell.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 5803fc75..139ccb73 100644 --- a/src/main.rs +++ b/src/main.rs @@ -587,7 +587,7 @@ fn run() -> Result<(), Error> { execute( &mut report, "Windows update", - || powershell.windows_update(run_type), + || powershell::Powershell::windows_powershell().windows_update(run_type), config.no_retry(), )?; } diff --git a/src/steps/powershell.rs b/src/steps/powershell.rs index bc40546a..6b5cdd89 100644 --- a/src/steps/powershell.rs +++ b/src/steps/powershell.rs @@ -32,6 +32,14 @@ impl Powershell { Powershell { path, profile } } + #[cfg(windows)] + pub fn windows_powershell() -> Self { + Powershell { + path: which("powershell").filter(|_| !is_dumb()), + profile: None, + } + } + #[cfg(windows)] pub fn has_module(powershell: &PathBuf, command: &str) -> bool { Command::new(&powershell)