diff --git a/src/steps/os/windows.rs b/src/steps/os/windows.rs index 2a6763fe..fa5be586 100644 --- a/src/steps/os/windows.rs +++ b/src/steps/os/windows.rs @@ -1,6 +1,6 @@ use crate::error::Error; use crate::executor::{CommandExt, RunType}; -use crate::terminal::print_separator; +use crate::terminal::{is_dumb, print_separator}; use crate::utils::{self, which}; use log::error; use std::path::PathBuf; @@ -46,9 +46,13 @@ pub struct Powershell { } impl Powershell { + /// Returns a powershell instance. + /// + /// If the powershell binary is not found, or the current terminal is dumb + /// then the instance of this struct will skip all the powershell steps. pub fn new() -> Self { Powershell { - path: which("powershell"), + path: which("powershell").filter(|_| !is_dumb()), } } diff --git a/src/terminal.rs b/src/terminal.rs index 610b63a2..1b99988a 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -126,3 +126,8 @@ pub fn print_warning>(message: P) { pub fn print_result>(key: P, succeeded: bool) { TERMINAL.lock().unwrap().print_result(key, succeeded) } + +/// Tells whether the terminal is dumb. +pub fn is_dumb() -> bool { + TERMINAL.lock().unwrap().width.is_none() +}