Merge branch 'master' into sync-repo-darcs
[cabal.git] / appveyor-retry.cmd
blobac3836508576b869ec0fb87acfefaf3665a9532b
1 @echo off
2 rem Source: https://github.com/appveyor/ci/blob/master/scripts/appveyor-retry.cmd
3 rem initiate the retry number
4 set retryNumber=0
5 set maxRetries=3
7 :RUN
8 %*
9 set LastErrorLevel=%ERRORLEVEL%
10 IF %LastErrorLevel% == 0 GOTO :EOF
11 set /a retryNumber=%retryNumber%+1
12 IF %reTryNumber% == %maxRetries% (GOTO :FAILED)
14 :RETRY
15 set /a retryNumberDisp=%retryNumber%+1
16 @echo Command "%*" failed with exit code %LastErrorLevel%. Retrying %retryNumberDisp% of %maxRetries%
17 GOTO :RUN
19 : FAILED
20 @echo Sorry, we tried running command for %maxRetries% times and all attempts were unsuccessful!
21 EXIT /B %LastErrorLevel%