Skip to content
Myr

Revert "[Fix] `nvm_die_on_prefix`: only grep lines starting with env var name" (#2347)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit 21c0c05130d9bdd275f29ccb158fa7103493903a. Fixes #2360. Fixes #2364. Fixes #2366.

authored by Jordan Harband · committed by Jordan Harband · parent 661a702 · Browse files · 2 files+1 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+1 added−4 removed

  • tests:+0 added−3 removed
  • other:+1 added−1 removed

2 files+1 added−4 removed

modified:test/fast/Unit tests/nvm_die_on_prefix-3 removed
82 unmodified lines
83EXIT_CODE="$(export npm_CONFIG_PREFIX=bar ; nvm_die_on_prefix 0 foo "$(nvm_version_dir new)" >/dev/null 2>&1; echo $?)"84[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT'; got '$OUTPUT'"85[ "_$EXIT_CODE" = "_4" ] || die "'npm_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo' did not exit with 4; got '$EXIT_CODE'"8687OUTPUT="$(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'"8987# npmrc tests88(89 cd "${TEST_DIR}"90 touch package.json
99 unmodified lines
modified:nvm.sh+1 added-1 removed
2350 unmodified lines
2351 #2352 # here, we avoid trying to replicate "which one wins" or testing the value; if any are defined, it errors2353 # until none are left.2354 local NVM_NPM_CONFIG_PREFIX_ENV2355 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}')"2356 if [ -n "${NVM_NPM_CONFIG_PREFIX_ENV-}" ]; then2357 local NVM_CONFIG_VALUE2358 eval "NVM_CONFIG_VALUE=\"\$${NVM_NPM_CONFIG_PREFIX_ENV}\""2359 if [ -n "${NVM_CONFIG_VALUE-}" ] && ! nvm_tree_contains_path "${NVM_DIR}" "${NVM_CONFIG_VALUE}"; then
1764 unmodified lines