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 first_try=1
|
||||||
local vendor_locations
|
local vendor_locations
|
||||||
local temporary_path
|
local temporary_path
|
||||||
|
local curl_exit_code=0
|
||||||
|
|
||||||
curl_args=()
|
curl_args=()
|
||||||
|
|
||||||
@ -149,19 +150,27 @@ fetch() {
|
|||||||
# HOMEBREW_CURL is set by brew.sh (and isn't misspelt here)
|
# HOMEBREW_CURL is set by brew.sh (and isn't misspelt here)
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
"${HOMEBREW_CURL}" "${curl_args[@]}" -C - "${url}" -o "${temporary_path}"
|
"${HOMEBREW_CURL}" "${curl_args[@]}" -C - "${url}" -o "${temporary_path}"
|
||||||
if [[ $? -eq 33 ]]
|
curl_exit_code="$?"
|
||||||
|
if [[ "${curl_exit_code}" -eq 33 ]]
|
||||||
then
|
then
|
||||||
[[ -n "${HOMEBREW_QUIET}" ]] || echo "Trying a full download" >&2
|
[[ -n "${HOMEBREW_QUIET}" ]] || echo "Trying a full download" >&2
|
||||||
rm -f "${temporary_path}"
|
rm -f "${temporary_path}"
|
||||||
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
||||||
|
curl_exit_code="$?"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
"${HOMEBREW_CURL}" "${curl_args[@]}" "${url}" -o "${temporary_path}"
|
||||||
|
curl_exit_code="$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f "${temporary_path}" ]] && break
|
[[ -f "${temporary_path}" ]] && break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ "${curl_exit_code}" -ne 0 ]]
|
||||||
|
then
|
||||||
|
rm -f "${temporary_path}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -f "${temporary_path}" ]]
|
if [[ ! -f "${temporary_path}" ]]
|
||||||
then
|
then
|
||||||
vendor_locations="$(printf " - %s\n" "${VENDOR_URLs[@]}")"
|
vendor_locations="$(printf " - %s\n" "${VENDOR_URLs[@]}")"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user