From 32c004a3bfde258b7740e45d685948a750b93c5f Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 15 Aug 2019 09:20:31 +0300 Subject: [PATCH] Fix module detection in Powershell --- src/steps/powershell.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/steps/powershell.rs b/src/steps/powershell.rs index 933593d9..05f2efe7 100644 --- a/src/steps/powershell.rs +++ b/src/steps/powershell.rs @@ -34,13 +34,11 @@ impl Powershell { #[cfg(windows)] pub fn has_module(powershell: &PathBuf, command: &str) -> bool { - || -> Result<(), Error> { - Command::new(&powershell) - .args(&["-Command", &format!("Get-Module -ListAvailable {}", command)]) - .check_output()?; - Ok(()) - }() - .is_ok() + Command::new(&powershell) + .args(&["-Command", &format!("Get-Module -ListAvailable {}", command)]) + .check_output() + .map(|result| !result.is_empty()) + .unwrap_or(false) } pub fn profile(&self) -> Option<&PathBuf> {