[Fix] nvm_install_binary: return failure when binary download fails with -b

When `nosource=1` (the `-b` flag) and binary download fails, the function returned 0 (success) instead of a non-zero exit code, masking the installation failure.

Bug introduced in https://github.com/nvm-sh/nvm/commit/4fdef427e4b1d563570ba5992bdbe7d7e23f025b / #2439.
This commit is contained in:
Jordan Harband committed 2026-03-14 14:29:56 -07:00
1 parent 39e71eab49
commit 05d784772c
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -2374,7 +2374,7 @@ nvm_install_binary() {
# Read nosource from arguments
if [ "${nosource-}" = '1' ]; then
nvm_err 'Binary download failed. Download from source aborted.'
return 0
return 2
fi
nvm_err 'Binary download failed, trying source.'