-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Fix] nvm_die_on_prefix
: filter prefixed env vars on name only, ignoring values
#2368
Conversation
de470fc
to
ed5069a
Compare
Yes, we definitely should. Since I'm unable to reproduce #2360 on my own machine, that suggests it's more complicated than just "zsh" or "arch" etc, so I think it's important to have a test that captures it. |
nvm.sh
Outdated
@@ -2352,7 +2352,7 @@ nvm_die_on_prefix() { | |||
# here, we avoid trying to replicate "which one wins" or testing the value; if any are defined, it errors | |||
# until none are left. | |||
local NVM_NPM_CONFIG_PREFIX_ENV | |||
NVM_NPM_CONFIG_PREFIX_ENV="$(command env | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')" | |||
NVM_NPM_CONFIG_PREFIX_ENV="$(command awk 'BEGIN { for (name in ENVIRON) if (toupper(name) == "NPM_CONFIG_PREFIX") { print name; break } }')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know so little about awk :-) this seems like a great improvement.
cc @qomosoloto @ivancevich @ArmanMazdaee @zhengdai @pmourer can any of you test with this PR to make sure it doesn't reintroduce #2360? |
ed5069a
to
b16b387
Compare
b16b387
to
4879ebd
Compare
@mdwint i've rebased this; can you take another look and made sure i resolved the conflicts correctly? |
Hi @ljharb. Yes, this looks right to me. |
4879ebd
to
93e0070
Compare
Fixes #2367.
I expect this to be more robust than before, since it only considers the names of environment variables, not their values.
@ljharb Should we try to reproduce #2360 to test for regressions?