From ce73c086b6bb741734af1c735be9fdafee54567d Mon Sep 17 00:00:00 2001 From: "J.W" Date: Fri, 20 Oct 2017 15:15:32 +0800 Subject: [PATCH] Auto disable colored output for unsupported Windows shells --- Cargo.toml | 2 +- src/main.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 44b46ec..89c2187 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ repository = "sharkdp/fd" clap = "2.26.0" [dependencies] -ansi_term = "0.9" +ansi_term = "0.10" atty = "0.2" clap = "2.26.0" ignore = "0.2" diff --git a/src/main.rs b/src/main.rs index 8b3b78c..c064290 100644 --- a/src/main.rs +++ b/src/main.rs @@ -79,6 +79,8 @@ fn main() { Some("never") => false, _ => atty::is(Stream::Stdout), }; + #[cfg(windows)] + let colored_output = colored_output && ansi_term::enable_ansi_support().is_ok(); let ls_colors = if colored_output { Some(