Merge pull request #20063 from Homebrew/vendor-install-fail-fix
cmd/vendor-install: fix exit code handling for curl
This commit is contained in:
commit
ecd0d99001
@ -101,6 +101,7 @@ fetch() {
|
||||
local first_try=1
|
||||
local vendor_locations
|
||||
local temporary_path
|
||||
local curl_exit_code=0
|
||||
|
||||
curl_args=()
|
||||
|
||||
@ -149,19 +150,27 @@ fetch() {
|
||||
# HOMEBREW_CURL is set by brew.sh (and isn't misspelt here)
|
||||
# shellcheck disable=SC2153
|
||||
"${HOMEBREW_CURL}" "${curl_args[@]}" -C - "${url}" -o "${temporary_path}"
|
||||
if [[ $? -eq 33 ]]
|
||||
curl_exit_code="$?"
|
||||
if [[ "${curl_exit_code}" -eq 33 ]]
|
||||
then
|
||||
[[ -n "${HOMEBREW_QUIET}" ]] || echo "Trying a full download" >&2
|
||||
rm -f "${temporary_path}"
|
||||
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
||||
curl_exit_code="$?"
|
||||
fi
|
||||
else
|
||||
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
||||
curl_exit_code="$?"
|
||||
fi
|
||||
|
||||
[[ -f "${temporary_path}" ]] && break
|
||||
done
|
||||
|
||||
if [[ "${curl_exit_code}" -ne 0 ]]
|
||||
then
|
||||
rm -f "${temporary_path}"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${temporary_path}" ]]
|
||||
then
|
||||
vendor_locations="$(printf " - %s\n" "${VENDOR_URLs[@]}")"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user