Skip to content

Commit

Permalink
Revert "[Fix] nvm_die_on_prefix: only grep lines starting with env …
Browse files Browse the repository at this point in the history
…var name" (#2347)

This reverts commit 21c0c05.

Fixes #2360. Fixes #2364. Fixes #2366.
  • Loading branch information
ljharb committed Nov 28, 2020
1 parent 661a702 commit 3b57dfe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 env | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"
if [ -n "${NVM_NPM_CONFIG_PREFIX_ENV-}" ]; then
local NVM_CONFIG_VALUE
eval "NVM_CONFIG_VALUE=\"\$${NVM_NPM_CONFIG_PREFIX_ENV}\""
Expand Down
3 changes: 0 additions & 3 deletions test/fast/Unit tests/nvm_die_on_prefix
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ EXIT_CODE="$(export npm_CONFIG_PREFIX=bar ; nvm_die_on_prefix 0 foo "$(nvm_versi
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT'; got '$OUTPUT'"
[ "_$EXIT_CODE" = "_4" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not exit with 4; got '$EXIT_CODE'"

OUTPUT="$(export FOO='NPM_CONFIG_PREFIX' ; nvm_die_on_prefix 0 foo "$(nvm_version_dir new)" 2>&1)"
[ -z "$OUTPUT" ] || die "'nvm_die_on_prefix' was not a noop; got '$OUTPUT'"

# npmrc tests
(
cd "${TEST_DIR}"
Expand Down

0 comments on commit 3b57dfe

Please sign in to comment.