From d12ccb130d96fcff18ae1ee6ed3a45a9b5613e72 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Sep 2016 13:39:50 -0700 Subject: [PATCH] [Fix] `zsh`: when `warncreateglobal` is set, this line warns for some reason. Use `env` to suppress it. Fixes #1236. --- nvm.sh | 4 ++-- test/fast/Unit tests/nvm_die_on_prefix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvm.sh b/nvm.sh index ffae02a..965e9cb 100644 --- a/nvm.sh +++ b/nvm.sh @@ -1945,10 +1945,10 @@ nvm_die_on_prefix() { fi local NVM_NPM_PREFIX - NVM_NPM_PREFIX="$(NPM_CONFIG_LOGLEVEL=warn npm config get prefix)" + NVM_NPM_PREFIX="$(npm config --loglevel=warn get prefix)" if ! (nvm_tree_contains_path "$NVM_DIR" "$NVM_NPM_PREFIX" >/dev/null 2>&1); then if [ "_$NVM_DELETE_PREFIX" = "_1" ]; then - NPM_CONFIG_LOGLEVEL=warn npm config delete prefix + npm config --loglevel=warn delete prefix else nvm deactivate >/dev/null 2>&1 nvm_err "nvm is not compatible with the npm config \"prefix\" option: currently set to \"$NVM_NPM_PREFIX\"" diff --git a/test/fast/Unit tests/nvm_die_on_prefix b/test/fast/Unit tests/nvm_die_on_prefix index 9a0260d..de14deb 100755 --- a/test/fast/Unit tests/nvm_die_on_prefix +++ b/test/fast/Unit tests/nvm_die_on_prefix @@ -36,7 +36,7 @@ nvm_has() { return 0; } npm() { local args args="$@" - if [ "_$args" = "_config get prefix" ]; then + if [ "_$args" = "_config --loglevel=warn get prefix" ]; then echo "$(nvm_version_dir new)/good prefix" fi } @@ -60,7 +60,7 @@ EXIT_CODE="$(NPM_CONFIG_PREFIX=bar nvm_die_on_prefix 0 foo >/dev/null 2>&1; echo npm() { local args args="$@" - if [ "_$args" = "_config get prefix" ]; then + if [ "_$args" = "_config --loglevel=warn get prefix" ]; then echo "./bad prefix" fi }