mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-21 19:33:26 +00:00
CI(macOS): retry flaky hdiutil DMG creation; delete per-arch bundles only on success
This commit is contained in:
16
scripts/retry.sh
Normal file
16
scripts/retry.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sourceable helper: `retry <cmd...>` runs a command, retrying up to 3 times
|
||||
# with a 5-minute wait between attempts. Useful for flaky commands such as
|
||||
# `hdiutil create` intermittently failing with "Resource busy".
|
||||
retry() {
|
||||
local attempt=1 max_attempts=3 delay=300
|
||||
until "$@"; do
|
||||
if [ "$attempt" -ge "$max_attempts" ]; then
|
||||
echo "::error::Command failed after $attempt attempts: $*"
|
||||
return 1
|
||||
fi
|
||||
echo "Attempt $attempt failed: $*. Retrying in $((delay / 60)) minutes..."
|
||||
sleep "$delay"
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user