npm config get prefix to background

This commit is contained in:
adabru 2016-05-05 03:36:30 +02:00
parent 6fb94e0dab
commit 869b273c77

6
nvm.sh
View File

@ -1534,13 +1534,15 @@ nvm_die_on_prefix() {
return return
fi fi
check_prefix() {
local NVM_NPM_PREFIX local NVM_NPM_PREFIX
NVM_NPM_PREFIX="$(NPM_CONFIG_LOGLEVEL=warn npm config get prefix)" NVM_NPM_PREFIX="$(NPM_CONFIG_LOGLEVEL=warn npm config get prefix 2>&1)"
if ! (nvm_tree_contains_path "$NVM_DIR" "$NVM_NPM_PREFIX" >/dev/null 2>&1); then if ! (nvm_tree_contains_path "$NVM_DIR" "$NVM_NPM_PREFIX" >/dev/null 2>&1); then
if [ "_$NVM_DELETE_PREFIX" = "_1" ]; then if [ "_$NVM_DELETE_PREFIX" = "_1" ]; then
NPM_CONFIG_LOGLEVEL=warn npm config delete prefix NPM_CONFIG_LOGLEVEL=warn npm config delete prefix
else else
nvm deactivate >/dev/null 2>&1 nvm deactivate >/dev/null 2>&1
echo >&2 ""
echo >&2 "nvm is not compatible with the npm config \"prefix\" option: currently set to \"$NVM_NPM_PREFIX\"" echo >&2 "nvm is not compatible with the npm config \"prefix\" option: currently set to \"$NVM_NPM_PREFIX\""
if nvm_has 'npm'; then if nvm_has 'npm'; then
echo >&2 "Run \`npm config delete prefix\` or \`$NVM_COMMAND\` to unset it." echo >&2 "Run \`npm config delete prefix\` or \`$NVM_COMMAND\` to unset it."
@ -1551,6 +1553,8 @@ nvm_die_on_prefix() {
fi fi
fi fi
} }
(check_prefix &)
}
# Succeeds if $IOJS_VERSION represents an io.js version that has a # Succeeds if $IOJS_VERSION represents an io.js version that has a
# Solaris binary, fails otherwise. # Solaris binary, fails otherwise.