Skip to content

Commit 3b57dfe

Browse files
committed
Revert "[Fix] nvm_die_on_prefix: only grep lines starting with env var name" (#2347)
This reverts commit 21c0c05. Fixes #2360. Fixes #2364. Fixes #2366.
1 parent 661a702 commit 3b57dfe

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

nvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,7 @@ nvm_die_on_prefix() {
23522352
# here, we avoid trying to replicate "which one wins" or testing the value; if any are defined, it errors
23532353
# until none are left.
23542354
local NVM_NPM_CONFIG_PREFIX_ENV
2355-
NVM_NPM_CONFIG_PREFIX_ENV="$(command env | nvm_grep -i ^NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"
2355+
NVM_NPM_CONFIG_PREFIX_ENV="$(command env | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"
23562356
if [ -n "${NVM_NPM_CONFIG_PREFIX_ENV-}" ]; then
23572357
local NVM_CONFIG_VALUE
23582358
eval "NVM_CONFIG_VALUE=\"\$${NVM_NPM_CONFIG_PREFIX_ENV}\""

test/fast/Unit tests/nvm_die_on_prefix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ EXIT_CODE="$(export npm_CONFIG_PREFIX=bar ; nvm_die_on_prefix 0 foo "$(nvm_versi
8484
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT'; got '$OUTPUT'"
8585
[ "_$EXIT_CODE" = "_4" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not exit with 4; got '$EXIT_CODE'"
8686

87-
OUTPUT="$(export FOO='NPM_CONFIG_PREFIX' ; nvm_die_on_prefix 0 foo "$(nvm_version_dir new)" 2>&1)"
88-
[ -z "$OUTPUT" ] || die "'nvm_die_on_prefix' was not a noop; got '$OUTPUT'"
89-
9087
# npmrc tests
9188
(
9289
cd "${TEST_DIR}"

0 commit comments

Comments
 (0)