mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 21:08:23 +08:00
[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:
@@ -30,9 +30,10 @@ nvm_echo "$CAPTURED_STDERR" | nvm_grep -q "${EXPECTED_ERR}" \
|
||||
|
||||
# --offline should not require curl or wget
|
||||
nvm_has() { return 1; }
|
||||
nvm_has_executable() { return 1; }
|
||||
try_err nvm install --offline 999.999.999
|
||||
# Should fail with "not found" not "nvm needs curl or wget"
|
||||
nvm_echo "$CAPTURED_STDERR" | nvm_grep -q "curl or wget" \
|
||||
&& die "nvm install --offline should not require curl or wget"
|
||||
alias nvm_has='\nvm_has'
|
||||
unset -f nvm_has
|
||||
unset -f nvm_has nvm_has_executable
|
||||
|
||||
Reference in New Issue
Block a user