You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1dac6ac
Browse filesBrowse the repository at this point in the historyBrowse files
retry_pattern="${OPENCLAW_LIVE_COMMAND_RETRY_PATTERN:-ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|fetch failed|TLS connection|socket hang up|UND_ERR|\\b429\\b|\\b529\\b}"
17
+
18
+
if! [[ "$attempts"=~ ^[1-9][0-9]*$ ]];then
19
+
echo"OPENCLAW_LIVE_COMMAND_ATTEMPTS must be a positive integer, got: $attempts">&2
20
+
exit 64
21
+
fi
22
+
23
+
if! [[ "$delay_seconds"=~ ^[0-9]+$ ]];then
24
+
echo"OPENCLAW_LIVE_COMMAND_RETRY_DELAY_SECONDS must be a non-negative integer, got: $delay_seconds">&2
25
+
exit 64
26
+
fi
27
+
28
+
log_file="$(mktemp)"
29
+
cleanup() {
30
+
rm -f "$log_file"
31
+
}
32
+
trap cleanup EXIT
33
+
34
+
forattemptin$(seq 1 "$attempts");do
35
+
:>"$log_file"
36
+
set +e
37
+
bash -o pipefail -c "$command"2>&1| tee "$log_file"
38
+
status="${PIPESTATUS[0]}"
39
+
set -e
40
+
41
+
if [[ "$status"-eq 0 ]];then
42
+
exit 0
43
+
fi
44
+
45
+
if [[ "$attempt"-ge"$attempts" ]];then
46
+
exit"$status"
47
+
fi
48
+
49
+
if! grep -Eiq "$retry_pattern""$log_file";then
50
+
exit"$status"
51
+
fi
52
+
53
+
echo"Live command failed with a retryable provider/network error; retrying ($attempt/$attempts)...">&2
0 commit comments