Guarding npm version printing with NVM_SILENT flag check; when sourcing nvm.sh, a considerable amount of time is spent running npm --version only for that output to be black-holed to /dev/null
parent
f2d31b0458
commit
9419794b19
4
nvm.sh
4
nvm.sh
|
@ -61,7 +61,7 @@ nvm_has_system_iojs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_print_npm_version() {
|
nvm_print_npm_version() {
|
||||||
if nvm_has "npm"; then
|
if [ "$NVM_SILENT" != "true" ] && nvm_has "npm"; then
|
||||||
echo " (npm v$(npm --version 2>/dev/null))"
|
echo " (npm v$(npm --version 2>/dev/null))"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1882,7 +1882,9 @@ if nvm_supports_source_options && [ "_$1" = "_--install" ]; then
|
||||||
nvm install >/dev/null
|
nvm install >/dev/null
|
||||||
fi
|
fi
|
||||||
elif [ -n "$VERSION" ]; then
|
elif [ -n "$VERSION" ]; then
|
||||||
|
NVM_SILENT="true"
|
||||||
nvm use "$VERSION" >/dev/null
|
nvm use "$VERSION" >/dev/null
|
||||||
|
unset NVM_SILENT
|
||||||
elif nvm_rc_version >/dev/null 2>&1; then
|
elif nvm_rc_version >/dev/null 2>&1; then
|
||||||
nvm use >/dev/null
|
nvm use >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue