Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tty: detect tty without depending on the color package #272

Merged
merged 1 commit into from
May 24, 2021
Merged

Conversation

fatih
Copy link
Member

@fatih fatih commented May 24, 2021

This PR fixes the issue when coloring is disabled with the NO_COLOR environment variable. This would set color.NoColor variable to true, and hence in an environment where NO_COLOR is set, commands like pscale auth login would fail:

$ pscale auth login
Error: The 'login' command requires an interactive shell

With this change, if the user sets the NO_COLOR environment variable, it continues to work, but only the colors are disabled.

This fixes the issue when coloring is disabled with `NO_COLOR` enviroment variable. This would set `color.NoColor` to true and hence in an enviroment where `NO_COLOR` is set, commands like `pscale auth login` would fail:

```
$ pscale auth login
Error: The 'login' command requires an interactive shell
```

Now, if the user sets the `NO_COLOR` environment variable, it still continues to work, but only the color's are disabled.
@fatih fatih requested a review from a team as a code owner May 24, 2021 11:23
@fatih fatih merged commit e27d04d into main May 24, 2021
@fatih fatih deleted the fatih-fix-tty branch May 24, 2021 12:01
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.

None yet

3 participants