Fix module detection in Powershell
This commit is contained in:
@@ -34,13 +34,11 @@ impl Powershell {
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn has_module(powershell: &PathBuf, command: &str) -> bool {
|
pub fn has_module(powershell: &PathBuf, command: &str) -> bool {
|
||||||
|| -> Result<(), Error> {
|
Command::new(&powershell)
|
||||||
Command::new(&powershell)
|
.args(&["-Command", &format!("Get-Module -ListAvailable {}", command)])
|
||||||
.args(&["-Command", &format!("Get-Module -ListAvailable {}", command)])
|
.check_output()
|
||||||
.check_output()?;
|
.map(|result| !result.is_empty())
|
||||||
Ok(())
|
.unwrap_or(false)
|
||||||
}()
|
|
||||||
.is_ok()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn profile(&self) -> Option<&PathBuf> {
|
pub fn profile(&self) -> Option<&PathBuf> {
|
||||||
|
|||||||
Reference in New Issue
Block a user