Skip to content

Commit 63467eb

Browse files
committed
fix(utils): check TERM=dumb before platform-specific color detection
The TERM=dumb check was only in the Unix code path, causing supports_color to return True on Windows CI runners where build >= 10586. Move the check before the platform branch so it applies universally.
1 parent 39f2b1d commit 63467eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

andes/utils/misc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ def supports_color(stream=None):
114114
if not hasattr(stream, 'isatty') or not stream.isatty():
115115
return False
116116

117+
# 'dumb' terminal universally means no color support
118+
if os.environ.get('TERM') == 'dumb':
119+
return False
120+
117121
if platform.system() == 'Windows':
118122
# Windows 10 build 10586+ supports ANSI natively in conhost/WT
119123
try:
@@ -125,8 +129,7 @@ def supports_color(stream=None):
125129
or 'TERM_PROGRAM' in os.environ
126130
or win_build >= 10586)
127131

128-
# Unix: only the 'dumb' terminal lacks color support
129-
return os.environ.get('TERM') != 'dumb'
132+
return True
130133

131134

132135
class ColoredFormatter(logging.Formatter):

0 commit comments

Comments
 (0)