From 0cfae3d5eb2187a4ef517ee2f0167064caea46cc Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 20 Jul 2020 15:23:25 +0300 Subject: [PATCH] Run Windows update with Powershell using sudo (fix #477) (#481) --- src/steps/powershell.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/steps/powershell.rs b/src/steps/powershell.rs index bd486650..10c2c161 100644 --- a/src/steps/powershell.rs +++ b/src/steps/powershell.rs @@ -81,8 +81,15 @@ impl Powershell { debug_assert!(self.supports_windows_update()); - ctx.run_type() - .execute(&powershell) + let mut command = if let Some(sudo) = ctx.sudo() { + let mut command = ctx.run_type().execute(sudo); + command.arg(&powershell); + command + } else { + ctx.run_type().execute(&powershell) + }; + + command .args(&[ "-Command", &format!(