Run Windows update specifically in the Windows powershell

This commit is contained in:
Roey Darwish Dror
2019-11-27 22:19:30 +02:00
parent e5f7c74c84
commit e0c294bd9e
2 changed files with 9 additions and 1 deletions

View File

@@ -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(),
)?;
}

View File

@@ -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)