[Fix] `set -u`: ensure `NVM_USE_OUTPUT` is always set.

Fixes #1671.
Jordan Harband 2017-11-23 10:02:37 -06:00
parent 7bfd1e0644
commit a57fe846e8
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
2 changed files with 3 additions and 2 deletions

3
nvm.sh
View File

@ -508,7 +508,7 @@ nvm_remote_versions() {
local NVM_LS_REMOTE_IOJS_EXIT_CODE local NVM_LS_REMOTE_IOJS_EXIT_CODE
NVM_LS_REMOTE_IOJS_EXIT_CODE=0 NVM_LS_REMOTE_IOJS_EXIT_CODE=0
local NVM_LS_REMOTE_IOJS_OUTPUT local NVM_LS_REMOTE_IOJS_OUTPUT
NVM_LS_REMOTE_IOJS_OUTPUT= NVM_LS_REMOTE_IOJS_OUTPUT=''
if [ -z "${NVM_LTS-}" ] && ( \ if [ -z "${NVM_LTS-}" ] && ( \
[ -z "${NVM_FLAVOR-}" ] || [ "${NVM_FLAVOR-}" = "${NVM_IOJS_PREFIX}" ] \ [ -z "${NVM_FLAVOR-}" ] || [ "${NVM_FLAVOR-}" = "${NVM_IOJS_PREFIX}" ] \
); then ); then
@ -2902,6 +2902,7 @@ nvm() {
command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current" command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
fi fi
local NVM_USE_OUTPUT local NVM_USE_OUTPUT
NVM_USE_OUTPUT=''
if [ $NVM_USE_SILENT -ne 1 ]; then if [ $NVM_USE_SILENT -ne 1 ]; then
if nvm_is_iojs_version "$VERSION"; then if nvm_is_iojs_version "$VERSION"; then
NVM_USE_OUTPUT="Now using io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm_print_npm_version)" NVM_USE_OUTPUT="Now using io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm_print_npm_version)"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -ex set -eux
cleanup() { cleanup() {
unset -f nvm_has_system_node nvm_print_npm_version unset -f nvm_has_system_node nvm_print_npm_version