[Fix] nvm_download, nvm_get_latest, install: only select a downloader that exists as an executable

`nvm_has` matches shell functions and aliases,
but downloads now run via `command`, which skips them
- a `curl` shell function with no curl binary on the PATH would select the curl path and fail with exit 127,
instead of falling back to an available wget executable.
The new `nvm_has_executable` helper resolves names the same way `command` does, so downloader selection and execution agree.
This commit is contained in:
Jordan Harband
2026-07-08 13:03:16 -07:00
parent 04fef13bdc
commit 9142a92cdc
6 changed files with 59 additions and 15 deletions
@@ -3,7 +3,7 @@
die () { echo "$@" ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_has
unset -f nvm_has nvm_has_executable
}
: nvm.sh
@@ -12,6 +12,7 @@ cleanup() {
\. ../../common.sh
nvm_has() { return 1 ; }
nvm_has_executable() { return 1 ; }
try_err nvm_get_latest
[ "_$CAPTURED_STDERR" = "_nvm needs curl or wget to proceed." ] \