Handle failed downloads properly

This commit is contained in:
Eugene Rakhmatulin
2026-02-18 14:55:43 -08:00
parent 12fd8a4503
commit 8873a0d959

View File

@@ -105,9 +105,14 @@ for a in assets:
fi
local URL NAME
local URL NAME TMP_WHL
while IFS=' ' read -r URL NAME; do
echo "Downloading $NAME..."
if ! curl -L --progress-bar --connect-timeout 30 "$URL" -o "$WHEELS_DIR/$NAME"; then
TMP_WHL=$(mktemp "$WHEELS_DIR/${NAME}.XXXXXX")
if curl -L --progress-bar --connect-timeout 30 "$URL" -o "$TMP_WHL"; then
mv "$TMP_WHL" "$WHEELS_DIR/$NAME"
else
rm -f "$TMP_WHL"
echo "Failed to download $NAME."
return 1
fi