mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-26 04:10:36 +08:00
[Fix] nvm_die_on_prefix: filter prefixed env vars on name only, ignoring values
This commit is contained in:
committed by
Jordan Harband
parent
10189bf4cb
commit
93e0070a44
6
nvm.sh
6
nvm.sh
@@ -2488,11 +2488,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_x_PREFIX_ENV
|
||||
if [ -n "${BASH_SOURCE-}" ]; then
|
||||
NVM_NPM_CONFIG_x_PREFIX_ENV="$(command set | command awk -F '=' '! /^[0-9A-Z_a-z]+=/ {skip=1} skip==0 {print $1}' | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1)"
|
||||
else
|
||||
NVM_NPM_CONFIG_x_PREFIX_ENV="$(command env | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"
|
||||
fi
|
||||
NVM_NPM_CONFIG_x_PREFIX_ENV="$(command awk 'BEGIN { for (name in ENVIRON) if (toupper(name) == "NPM_CONFIG_PREFIX") { print name; break } }')"
|
||||
if [ -n "${NVM_NPM_CONFIG_x_PREFIX_ENV-}" ]; then
|
||||
local NVM_CONFIG_VALUE
|
||||
eval "NVM_CONFIG_VALUE=\"\$${NVM_NPM_CONFIG_x_PREFIX_ENV}\""
|
||||
|
||||
Reference in New Issue
Block a user