Default to $TERM unset = colour on Win32

This otherwise respects all other configuration
(NO_COLOR, TERM=dumb, &c.), but it's very common for the environment to
be lacking TERM, which in that case usually means a pro-verbial
TERM=cmd.exe, which is colourful

Fixes: 049d1138c9 ("Don't output colours
 by default if TERM=dumb or NO_COLOR=1")
This commit is contained in:
наб authored and David Peter committed 2022-10-29 14:48:25 +02:00
1 parent 69c91f5b2d
commit af2f0ace22
1 file changed
+1 -1
+1 -1
View File
@@ -300,7 +300,7 @@ impl Options {
OutputStyleOption::Basic
} else if env::var_os("TERM")
.map(|t| t == "unknown" || t == "dumb")
.unwrap_or(true)
.unwrap_or(!cfg!(target_os = "windows"))
|| env::var_os("NO_COLOR")
.map(|t| !t.is_empty())
.unwrap_or(false)