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

Disable colors when stdout is not a terminal. #2634

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Disable colors when stdout is not a terminal. #2634

wants to merge 2 commits into from

Conversation

heinthanth
Copy link

@heinthanth heinthanth commented Oct 18, 2021

Fixes #2497

@heinthanth
Copy link
Author

Can someone review this … ?

@ljharb
Copy link
Member

ljharb commented Oct 19, 2021

It looks good, but there's a bunch of tests failing.

@ljharb ljharb marked this pull request as draft October 19, 2021 19:17
@heinthanth
Copy link
Author

heinthanth commented Oct 20, 2021

Failure on WSL is a failure from action itself.

Failure on travis is quite interesting. But I didn't changed any core codes. I just used --no-colors arguments ( forcibly set if stdout is not a terminal ). I think travis must fail too ( when using --no-colors )

Edit: some errors are confusing ... What's *

'nvm alias default did not return 'default -> 0.10.1 (-> v0.10.1)', got 'default -> 0.10.1 (-> v0.10.1 *)'

Edit: tested on local machine

@ljharb, I think ... travis use | to capture stdout. But using pipe cause stdout is not a terminal. So that, output has *.

It's the same with original nvm using --no-colors. I think we need to update travis scripts Or we'll have to use another method to disable colors.

Screen Shot 2021-10-20 at 12 44 43 PM

@ljharb
Copy link
Member

ljharb commented Oct 20, 2021

When colors are disabled, nvm uses symbols, instead of colors, to convey information.

In other words, there may be tests that are expecting the color output, and this change means those tests need to be updated.

@jorgeluisrdz16

This comment has been minimized.

@heinthanth heinthanth marked this pull request as ready for review November 4, 2021 01:45
@ljharb
Copy link
Member

ljharb commented Nov 4, 2021

All the "fast" and "sourcing" tests are failing.

@jorgeluisrdz16

This comment has been minimized.

@ljharb ljharb marked this pull request as draft November 7, 2021 21:28
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.

nvm ls outputs color codes when piped to another command
4 participants