mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-18 19:43:43 +00:00
Compare commits
3 Commits
1fab7dd73e
...
3dd1691e09
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3dd1691e09 | ||
![]() |
4beab63631 | ||
![]() |
7290bb1063 |
42
nvm.sh
42
nvm.sh
@ -128,24 +128,24 @@ nvm_download() {
|
|||||||
if nvm_curl_use_compression; then
|
if nvm_curl_use_compression; then
|
||||||
CURL_COMPRESSED_FLAG="--compressed"
|
CURL_COMPRESSED_FLAG="--compressed"
|
||||||
fi
|
fi
|
||||||
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} $*"
|
eval "curl -q --fail -w %{http_code} ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} $*"
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||||
-e 's/--compressed //' \
|
-e 's/--compressed //' \
|
||||||
-e 's/--fail //' \
|
-e 's/--fail //' \
|
||||||
-e 's/-L //' \
|
-e 's/-L //' \
|
||||||
-e 's/-I /--server-response /' \
|
-e 's/-I /--server-response /' \
|
||||||
-e 's/-s /-q /' \
|
-e 's/-s /-q /' \
|
||||||
-e 's/-sS /-nv /' \
|
-e 's/-sS /-nv /' \
|
||||||
-e 's/-o /-O /' \
|
-e 's/-o /-O /' \
|
||||||
-e 's/-C - /-c /')
|
-e 's/-C - /-c /')
|
||||||
|
|
||||||
if [ -n "${NVM_AUTH_HEADER:-}" ]; then
|
if [ -n "${NVM_AUTH_HEADER:-}" ]; then
|
||||||
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
|
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
eval wget $ARGS
|
eval wget -S $ARGS 2>&1 | grep '^ HTTP/' | awk '{print $2}'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,9 +503,9 @@ $(nvm_wrap_with_color_code 'y' "${warn_text}")"
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvm_process_nvmrc() {
|
nvm_process_nvmrc() {
|
||||||
local NVMRC_PATH="$1"
|
local NVMRC_PATH
|
||||||
|
NVMRC_PATH="$1"
|
||||||
local lines
|
local lines
|
||||||
local unpaired_line
|
|
||||||
|
|
||||||
lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$')
|
lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$')
|
||||||
|
|
||||||
@ -515,8 +515,12 @@ nvm_process_nvmrc() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize key-value storage
|
# Initialize key-value storage
|
||||||
local keys=''
|
local keys
|
||||||
local values=''
|
keys=''
|
||||||
|
local values
|
||||||
|
values=''
|
||||||
|
local unpaired_line
|
||||||
|
unpaired_line=''
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [ -z "${line}" ]; then
|
if [ -z "${line}" ]; then
|
||||||
@ -2434,12 +2438,18 @@ nvm_download_artifact() {
|
|||||||
nvm_err "Removing the broken local cache..."
|
nvm_err "Removing the broken local cache..."
|
||||||
command rm -rf "${TARBALL}"
|
command rm -rf "${TARBALL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nvm_err "Downloading ${TARBALL_URL}..."
|
nvm_err "Downloading ${TARBALL_URL}..."
|
||||||
nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || (
|
local NVM_DOWNLOAD_RESULT
|
||||||
|
NVM_DOWNLOAD_RESULT=$(nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}")
|
||||||
|
if [ "${NVM_DEBUG-}" = 1 ]; then
|
||||||
|
nvm_err "Download HTTP Status ${NVM_DOWNLOAD_RESULT}"
|
||||||
|
fi
|
||||||
|
if [ "${NVM_DOWNLOAD_RESULT}" != '200' ]; then
|
||||||
command rm -rf "${TARBALL}" "${tmpdir}"
|
command rm -rf "${TARBALL}" "${tmpdir}"
|
||||||
nvm_err "download from ${TARBALL_URL} failed"
|
nvm_err "download from ${TARBALL_URL} failed"
|
||||||
return 4
|
return 4
|
||||||
)
|
fi
|
||||||
|
|
||||||
if nvm_grep '404 Not Found' "${TARBALL}" >/dev/null; then
|
if nvm_grep '404 Not Found' "${TARBALL}" >/dev/null; then
|
||||||
command rm -rf "${TARBALL}" "${tmpdir}"
|
command rm -rf "${TARBALL}" "${tmpdir}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user