diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/colors.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/colors.rs b/runtime/colors.rs index fe5a3dcbe..8d915b571 100644 --- a/runtime/colors.rs +++ b/runtime/colors.rs @@ -22,8 +22,11 @@ use termcolor::BufferWriter; #[cfg(windows)] use termcolor::ColorChoice; -static NO_COLOR: Lazy<bool> = - Lazy::new(|| std::env::var_os("NO_COLOR").is_some()); +static NO_COLOR: Lazy<bool> = Lazy::new(|| { + std::env::var_os("NO_COLOR") + .map(|v| !v.is_empty()) + .unwrap_or(false) +}); static IS_TTY: Lazy<bool> = Lazy::new(|| std::io::stdout().is_terminal()); |