diff options
| author | Menny Even Danan <menny@evendanan.net> | 2019-10-31 13:17:41 +0000 |
|---|---|---|
| committer | Menny Even Danan <menny@evendanan.net> | 2019-10-31 14:53:32 +0000 |
| commit | b7ab60fb376b1c93415b85a350bd8778c7046eec (patch) | |
| tree | f77e7c49654cae90091dabf7ed071ea8dc361b3d /scripts/retry.sh | |
| parent | 1f1990d3330c5ea529eb7dc2343a9ad53eeefc36 (diff) | |
| download | AnySoftKeyboard-b7ab60fb376b1c93415b85a350bd8778c7046eec.tar.gz AnySoftKeyboard-b7ab60fb376b1c93415b85a350bd8778c7046eec.tar.bz2 | |
Retry for uploading coverage
Diffstat (limited to 'scripts/retry.sh')
| -rwxr-xr-x | scripts/retry.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/retry.sh b/scripts/retry.sh new file mode 100755 index 000000000..82455169a --- /dev/null +++ b/scripts/retry.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +#Taken from https://gist.github.com/sj26/88e1c6584397bb7c13bd11108a579746 + +retries=$1 +shift + +count=0 +until "$@"; do + exit=$? + count=$(($count + 1)) + if [[ ${count} -lt ${retries} ]]; then + echo "Retry ${count}/${retries} exited ${exit}, retrying in ${count} seconds..." + sleep ${count} + else + echo "Retry ${count}/${retries} exited ${exit}, no more retries left." + exit ${exit} + fi +done |
