[Fix] To confirm curl exists before detecting curl libz feature

Peter Dave Hello 2017-04-09 13:44:07 +08:00
parent e87f395b7a
commit 153f8e7b31
1 changed files with 3 additions and 3 deletions

2
nvm.sh
View File

@ -82,10 +82,10 @@ nvm_curl_libz_support() {
nvm_get_latest() {
local NVM_LATEST_URL
local CURL_COMPRESSED_FLAG
if nvm_has "curl"; then
if nvm_curl_libz_support; then
CURL_COMPRESSED_FLAG="--compressed"
fi
if nvm_has "curl"; then
NVM_LATEST_URL="$(curl "${CURL_COMPRESSED_FLAG:-}" -q -w "%{url_effective}\n" -L -s -S http://latest.nvm.sh -o /dev/null)"
elif nvm_has "wget"; then
NVM_LATEST_URL="$(wget http://latest.nvm.sh --server-response -O /dev/null 2>&1 | command awk '/^ Location: /{DEST=$2} END{ print DEST }')"