Skip to content

Improve reliability of downloading PE tarball #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 28, 2021
Merged
13 changes: 12 additions & 1 deletion tasks/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ verify-file() {

download() {
printf '%s\n' "Downloading: ${1}"
curl -s -f -L -o "$2" "$1"
tmp_file=$(mktemp)
echo "Temporary file created at: ${tmp_file}"

if curl -s -f -L -o ${tmp_file} "$1"; then
mv "${tmp_file}" "$2"
return 0
else
echo "Error: Curl has failed to download the file"
echo "Removing temporary file: ${tmp_file}"
rm "${tmp_file}"
return 1
fi
}

download-size-verify() {
Expand Down