Skip to content

Do not output colors if stdout is not a tty#2

Closed
iulian3144 wants to merge 1 commit intohfeeki:masterfrom
iulian3144:master
Closed

Do not output colors if stdout is not a tty#2
iulian3144 wants to merge 1 commit intohfeeki:masterfrom
iulian3144:master

Conversation

@iulian3144
Copy link

If stdout is not a tty (e.g. a file), a user does not normally want to
have ANSI escape codes present in the output.
This commit adds a check (sys.stdout.isatty()) to verify if stdout is a
tty so it will only output color codes in this specific case.

If stdout is not a tty (e.g. a file), a user does not normally want to
have ANSI escape codes present in the output.
This commit adds a check (sys.stdout.isatty()) to verify if stdout is a
tty so it will only output color codes in this specific case.
@iulian3144 iulian3144 closed this by deleting the head repository Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant