Skip to content

Commit ffb3f6d

Browse files
committed
[Fix] nvm install -b: do not attempt to download source on a failed binary download with -b
Fixes 3399
1 parent 5488405 commit ffb3f6d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

nvm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ nvm_download_artifact() {
24372437
nvm_err "Downloading ${TARBALL_URL}..."
24382438
nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || (
24392439
command rm -rf "${TARBALL}" "${tmpdir}"
2440-
nvm_err "Binary download from ${TARBALL_URL} failed, trying source."
2440+
nvm_err "download from ${TARBALL_URL} failed"
24412441
return 4
24422442
)
24432443

@@ -3564,7 +3564,7 @@ nvm() {
35643564
fi
35653565
fi
35663566

3567-
if [ $EXIT_CODE -ne 0 ]; then
3567+
if [ $EXIT_CODE -ne 0 ] && [ $nosource -ne 1 ]; then
35683568
if [ -z "${NVM_MAKE_JOBS-}" ]; then
35693569
nvm_get_make_jobs
35703570
fi

test/fast/Unit tests/nvm install -b

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ die () { echo "$@" ; exit 1; }
44

55
\. ../../../nvm.sh
66

7+
nvm_install_source() {
8+
exit 42
9+
}
10+
711
VERSION="0.7.0"
812

913
EXIT_CODE=$(nvm install -b "${VERSION}" ; echo $?)

0 commit comments

Comments
 (0)