[Fix] nvm install -b: do not attempt to download source on a failed binary download with -b

Fixes #3399
This commit is contained in:
Jordan Harband 2024-08-01 10:35:37 -07:00
parent 271720ebfc
commit 14acd3dcdd
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
2 changed files with 6 additions and 2 deletions

4
nvm.sh
View File

@ -2437,7 +2437,7 @@ nvm_download_artifact() {
nvm_err "Downloading ${TARBALL_URL}..." nvm_err "Downloading ${TARBALL_URL}..."
nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || ( nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || (
command rm -rf "${TARBALL}" "${tmpdir}" command rm -rf "${TARBALL}" "${tmpdir}"
nvm_err "Binary download from ${TARBALL_URL} failed, trying source." nvm_err "download from ${TARBALL_URL} failed"
return 4 return 4
) )
@ -3564,7 +3564,7 @@ nvm() {
fi fi
fi fi
if [ $EXIT_CODE -ne 0 ]; then if [ $EXIT_CODE -ne 0 ] && [ $nosource -ne 1 ]; then
if [ -z "${NVM_MAKE_JOBS-}" ]; then if [ -z "${NVM_MAKE_JOBS-}" ]; then
nvm_get_make_jobs nvm_get_make_jobs
fi fi

View File

@ -4,6 +4,10 @@ die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh \. ../../../nvm.sh
nvm_install_source() {
exit 42
}
VERSION="0.7.0" VERSION="0.7.0"
EXIT_CODE=$(nvm install -b "${VERSION}" ; echo $?) EXIT_CODE=$(nvm install -b "${VERSION}" ; echo $?)