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
nvm ls
outputs color codes when piped to another command
#2497
Comments
nvm is not supported when installed from homebrew (altho this issue seems unrelated); please brew uninstall it and reinstall it from the only supported install method (the install script in the readme). I'm not sure why I can reproduce this issue, and I completely agree that when it's in a pipe, it shouldn't output colors. I don't think "TTY-ness" should dictate that, since it's not about interactivity (but your suggestion would certainly work, albeit with a lot of added complexity in nvm). Using some form of this technique should work here - when I naively use it in |
Thanks — I'm not 100% sure why nodenv was installed; it must have been left over from some time ago. For some reason zsh initialisation was working with it at the end of the file right up until I installed nvm, but removing nodenv entirely fixed it, and seems to be the more sensible option :) |
I've cover |
nvm ls
outputs colour codes when piped to another commandnvm ls
outputs color codes when piped to another command
Operating system and version: macOS 10.14.6 (18G8022)
nvm debug
output:nvm ls
output:How did you install
nvm
?Homebrew
What steps did you perform?
nvm ls | pbcopy
What happened?
All the ANSI codes were copied to the clipboard, as you can see from the section above.
What did you expect to happen?
nvm ls
should omit ANSI colour codes and outputs plain text when being piped to another command. This is in line with how other colour-using commands work, so would be generally expected behaviour. Having to add--no-colors
each time is a workaround, but it does not mirror the behaviour of other commands, which do the right thing automatically.Perhaps the default behaviour could be to use colours when outputting to a TTY, and no colours when not outputting to a TTY, and adding a new
--colors
flag which could be used to force the issue when colours are required in a pipe?Is there anything in any of your profile files that modifies the
PATH
?Yes; they all execute after
eval "$(nodenv init -)"
, which is at the top of the file.The text was updated successfully, but these errors were encountered: