mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-09 14:24:06 +07:00
Cleanup dependency code on macOS and add retry to git fetch
This commit is contained in:
20
src/scripts/tools/retry.sh
Normal file
20
src/scripts/tools/retry.sh
Normal file
@ -0,0 +1,20 @@
|
||||
function retry {
|
||||
local try=0
|
||||
|
||||
until "$@"; do
|
||||
exit_code="$?"
|
||||
try=$((try + 1))
|
||||
|
||||
if [ $try -lt 10 ]; then
|
||||
sleep "$((2 ** try))"
|
||||
else
|
||||
return $exit_code
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function git_retry {
|
||||
retry git "$@"
|
||||
}
|
Reference in New Issue
Block a user