[Fix] nvm_ls_remote_combined: propagate iojs remote listing failures

`return $A || $B` only evaluates the first argument, since `return` always succeeds.
The io.js exit code was never checked, silently swallowing remote listing failures.

Bug introduced in ea12784629 / #616.
This commit is contained in:
Jordan Harband
2026-03-14 09:39:20 -07:00
parent 6f428a10bb
commit a937cb595e
2 changed files with 72 additions and 1 deletions

5
nvm.sh
View File

@@ -878,7 +878,10 @@ ${NVM_LS_REMOTE_POST_MERGED_OUTPUT}" | nvm_grep -v "N/A" | command sed '/^ *$/d'
# the `sed` is to remove trailing whitespaces (see "weird behavior" ~25 lines up)
nvm_echo "${VERSIONS}" | command sed 's/ *$//g'
# shellcheck disable=SC2317
return $NVM_LS_REMOTE_EXIT_CODE || $NVM_LS_REMOTE_IOJS_EXIT_CODE
if [ "${NVM_LS_REMOTE_EXIT_CODE}" != '0' ]; then
return "${NVM_LS_REMOTE_EXIT_CODE}"
fi
return "${NVM_LS_REMOTE_IOJS_EXIT_CODE}"
}
nvm_is_valid_version() {