mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-08-25 19:31:11 +00:00
26 lines
620 B
Bash
26 lines
620 B
Bash
#!/usr/bin/env bash
|
|
set -uo pipefail
|
|
|
|
with_retry() {
|
|
local command="$1"
|
|
local max_attempts="${2:-3}"
|
|
local attempt=1
|
|
|
|
while (( attempt <= max_attempts )); do
|
|
if eval "$command"; then
|
|
return 0
|
|
fi
|
|
|
|
if (( attempt < max_attempts )); then
|
|
echo "::warning:: Attempt $attempt failed, cleaning up and retrying..." >&2
|
|
rm -rf target/debug/deps/*.o target/debug/incremental 2>/dev/null || true
|
|
cargo clean -p integration_tests 2>/dev/null || true
|
|
sleep 5
|
|
fi
|
|
|
|
(( attempt++ ))
|
|
done
|
|
|
|
echo "::error:: Command failed after $max_attempts attempts: $command" >&2
|
|
return 1
|
|
} |