bypass aliased curl

Meanwhile keeping nvm_curl_version and nvm_curl_libz_support as-is
to avoid breaking tests which redefines `curl` as a shell function.
This commit is contained in:
ryenus 2023-01-10 15:32:47 +08:00 committed by Jordan Harband
parent b77fcec399
commit 996ae54fde
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
2 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ nvm_node_version() {
nvm_download() {
if nvm_has "curl"; then
curl --fail --compressed -q "$@"
command curl --fail --compressed -q "$@"
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \

4
nvm.sh
View File

@ -101,7 +101,7 @@ nvm_get_latest() {
if nvm_curl_use_compression; then
CURL_COMPRESSED_FLAG="--compressed"
fi
NVM_LATEST_URL="$(curl ${CURL_COMPRESSED_FLAG:-} -q -w "%{url_effective}\\n" -L -s -S https://latest.nvm.sh -o /dev/null)"
NVM_LATEST_URL="$(command curl ${CURL_COMPRESSED_FLAG:-} -q -w "%{url_effective}\\n" -L -s -S https://latest.nvm.sh -o /dev/null)"
elif nvm_has "wget"; then
NVM_LATEST_URL="$(wget -q https://latest.nvm.sh --server-response -O /dev/null 2>&1 | command awk '/^ Location: /{DEST=$2} END{ print DEST }')"
else
@ -133,7 +133,7 @@ nvm_download() {
for arg in "$@"; do
NVM_DOWNLOAD_ARGS="${NVM_DOWNLOAD_ARGS} \"$arg\""
done
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
eval "command curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \