Skip to content

Commit

Permalink
[Fix] nvm install -b: do not attempt to download source on a failed…
Browse files Browse the repository at this point in the history
… binary download with `-b`

Fixes 3399
  • Loading branch information
ljharb committed Aug 1, 2024
1 parent 5488405 commit ffb3f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,7 @@ nvm_download_artifact() {
nvm_err "Downloading ${TARBALL_URL}..."
nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || (
command rm -rf "${TARBALL}" "${tmpdir}"
nvm_err "Binary download from ${TARBALL_URL} failed, trying source."
nvm_err "download from ${TARBALL_URL} failed"
return 4
)

Expand Down Expand Up @@ -3564,7 +3564,7 @@ nvm() {
fi
fi

if [ $EXIT_CODE -ne 0 ]; then
if [ $EXIT_CODE -ne 0 ] && [ $nosource -ne 1 ]; then
if [ -z "${NVM_MAKE_JOBS-}" ]; then
nvm_get_make_jobs
fi
Expand Down
4 changes: 4 additions & 0 deletions test/fast/Unit tests/nvm install -b
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ die () { echo "$@" ; exit 1; }

\. ../../../nvm.sh

nvm_install_source() {
exit 42
}

VERSION="0.7.0"

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

0 comments on commit ffb3f6d

Please sign in to comment.