Commit 28a2807 1 parent 64add74 commit 28a2807 Copy full SHA for 28a2807
File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1286,17 +1286,17 @@ fn should_use_color() -> bool {
1286
1286
return false ;
1287
1287
}
1288
1288
1289
- // Then check CLICOLOR_FORCE - if set, enable colors regardless of terminal
1290
- if std:: env:: var_os ( "CLICOLOR_FORCE" ) . is_some ( ) {
1289
+ // Then check CLICOLOR_FORCE - if set and not empty/"0" , enable colors regardless of terminal
1290
+ if std:: env:: var_os ( "CLICOLOR_FORCE" ) . is_some_and ( |e| !e . is_empty ( ) && e != "0" ) {
1291
1291
return true ;
1292
1292
}
1293
1293
1294
- // Check CLICOLOR - if set, use colors only when writing to a terminal
1295
- if std:: env:: var_os ( "CLICOLOR" ) . is_some ( ) {
1294
+ // Check CLICOLOR - if set and not empty/"0" , use colors only when writing to a terminal
1295
+ if std:: env:: var_os ( "CLICOLOR" ) . is_some_and ( |e| !e . is_empty ( ) && e != "0" ) {
1296
1296
return std:: io:: stdout ( ) . is_terminal ( ) ;
1297
1297
}
1298
1298
1299
- // Modern default (acting as if CLICOLOR is set):
1299
+ // Modern default (acting as if CLICOLOR is set)
1300
1300
std:: io:: stdout ( ) . is_terminal ( )
1301
1301
}
1302
1302
You can’t perform that action at this time.
0 commit comments