Enable exit on error immediately after download attempt (#7444)

This commit is contained in:
Vasilii Polikarpov
2023-04-18 17:26:22 +02:00
committed by GitHub
parent ff9186f1dc
commit bea98d0749

View File

@@ -28,6 +28,7 @@ download_with_retries() {
set +e set +e
http_code=$(eval $COMMAND) http_code=$(eval $COMMAND)
exit_code=$? exit_code=$?
set -e
if [ $http_code -eq 200 ] && [ $exit_code -eq 0 ]; then if [ $http_code -eq 200 ] && [ $exit_code -eq 0 ]; then
echo "Download completed" echo "Download completed"
return 0 return 0
@@ -35,8 +36,6 @@ download_with_retries() {
echo "Error — Either HTTP response code for '$URL' is wrong - '$http_code' or exit code is not 0 - '$exit_code'. Waiting $interval seconds before the next attempt, $retries attempts left" echo "Error — Either HTTP response code for '$URL' is wrong - '$http_code' or exit code is not 0 - '$exit_code'. Waiting $interval seconds before the next attempt, $retries attempts left"
sleep $interval sleep $interval
fi fi
# Enable exit on error back
set -e
done done
echo "Could not download $URL" echo "Could not download $URL"