From affcc5087ced701b88f7286d6b40e482941c8774 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 11 Feb 2017 23:14:58 -0800 Subject: [PATCH] [Fix] `set -e`: `nvm install lts/something`: call `nvm_ensure_default_set` with the proper value. Fixes #1394. --- nvm.sh | 6 +++++- test/installation_node/install LTS | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nvm.sh b/nvm.sh index 35e03861ac..cdbc026e64 100755 --- a/nvm.sh +++ b/nvm.sh @@ -2460,7 +2460,11 @@ nvm() { fi if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then - nvm_ensure_default_set "$provided_version" + if [ -n "${LTS-}" ]; then + nvm_ensure_default_set "lts/${LTS}" + else + nvm_ensure_default_set "$provided_version" + fi if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \ && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then nvm reinstall-packages "$REINSTALL_PACKAGES_FROM" diff --git a/test/installation_node/install LTS b/test/installation_node/install LTS index d83b90f5de..d0c07a2899 100755 --- a/test/installation_node/install LTS +++ b/test/installation_node/install LTS @@ -24,8 +24,6 @@ EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls- [ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<" [ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<" -set +e # TODO: fix nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed' -set -e [ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"