File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1400,7 +1400,7 @@ def banner():
14001400 if not any (_ in sys .argv for _ in ("--version" , "--api" )) and not conf .get ("disableBanner" ):
14011401 result = BANNER
14021402
1403- if not IS_TTY or any (_ in sys .argv for _ in ("--disable-coloring" , "--disable-colouring" )):
1403+ if not IS_TTY or conf . get ( "disableColoring" ) or any (_ in sys .argv for _ in ("--disable-coloring" , "--disable-colouring" )):
14041404 result = clearColors (result )
14051405 elif IS_WIN :
14061406 coloramainit ()
Original file line number Diff line number Diff line change 2323
2424 class _ColorizingStreamHandler (ColorizingStreamHandler ):
2525 def colorize (self , message , levelno , force = False ):
26+ from lib .core .data import conf # import inside function to avoid ImportError
27+ if conf .get ("disableColoring" ):
28+ return message
2629 if levelno in self .level_map and (self .is_tty or force ):
2730 bg , fg , bold = self .level_map [levelno ]
2831 params = []
Original file line number Diff line number Diff line change @@ -148,6 +148,11 @@ def main():
148148 resolveCrossReferences ()
149149 checkEnvironment ()
150150 setPaths (modulePath ())
151+
152+ # Check for NO_COLOR environment variable
153+ if os .environ .get ("NO_COLOR" ) not in (None , "" ):
154+ conf .disableColoring = True
155+
151156 banner ()
152157
153158 # Store original command line options for possible later restoration
You can’t perform that action at this time.
0 commit comments