core: some tweaks for better colour handling when we're redirecting stdout/stderr

This commit is contained in:
Dima Gerasimov 2023-06-21 19:56:33 +01:00 committed by karlicoss
parent 6f6be5c78e
commit c25ab51664
3 changed files with 8 additions and 3 deletions

View file

@ -16,7 +16,7 @@ def _colorize(x: str, color: Optional[str]=None) -> str:
if color is None:
return x
if not sys.stdout.isatty():
if not sys.stderr.isatty():
return x
# click handles importing/initializing colorama if necessary
# on windows it installs it if necessary