mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 12:58:21 +08:00
`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.
24 lines
510 B
Bash
Executable File
24 lines
510 B
Bash
Executable File
#!/bin/sh
|
|
|
|
die () { echo "$@" ; cleanup ; exit 1; }
|
|
|
|
cleanup() {
|
|
unset -f nvm_has nvm_has_executable
|
|
}
|
|
|
|
: nvm.sh
|
|
\. ../../../nvm.sh
|
|
|
|
\. ../../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." ] \
|
|
|| die "no curl/wget did not report correct error message, got '$CAPTURED_STDERR'"
|
|
[ "_$CAPTURED_EXIT_CODE" = "_1" ] \
|
|
|| die "no curl/wget did not exit with code 1, got $CAPTURED_EXIT_CODE"
|
|
|
|
cleanup
|