Skip to content

Commit

Permalink
Default to stdout isatty for colour detection instead of stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 4, 2025
1 parent 95352dc commit 088c47d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/_colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def can_colorize() -> bool:
if os.environ.get("TERM") == "dumb":
return False

if not hasattr(sys.stderr, "fileno"):
if not hasattr(sys.stdout, "fileno"):
return False

if sys.platform == "win32":
Expand All @@ -62,6 +62,6 @@ def can_colorize() -> bool:
return False

try:
return os.isatty(sys.stderr.fileno())
return os.isatty(sys.stdout.fileno())
except io.UnsupportedOperation:
return sys.stderr.isatty()
return sys.stdout.isatty()

0 comments on commit 088c47d

Please sign in to comment.