Limit number of retries when downloading the Dart SDK on Windows (#162411)
Disclaimer: I have no idea what I'm doing. I never wrote `.bat` code before. Fixes https://github.com/flutter/flutter/issues/162410
This commit is contained in:
@@ -145,6 +145,7 @@ GOTO :after_subroutine
|
||||
ECHO Either pwsh.exe or PowerShell.exe must be in your PATH. 1>&2
|
||||
EXIT 1
|
||||
)
|
||||
SET /A dart_sdk_retries+=1
|
||||
ECHO Checking Dart SDK version... 1>&2
|
||||
SET update_dart_bin=%FLUTTER_ROOT%\bin\internal\update_dart_sdk.ps1
|
||||
REM Escape apostrophes from the executable path
|
||||
@@ -157,7 +158,13 @@ GOTO :after_subroutine
|
||||
IF "%ERRORLEVEL%" EQU "2" (
|
||||
EXIT 1
|
||||
)
|
||||
SET max_dart_sdk_retries=3
|
||||
IF "%ERRORLEVEL%" NEQ "0" (
|
||||
IF "%dart_sdk_retries%" EQU "%max_dart_sdk_retries%" (
|
||||
ECHO Error: Unable to update Dart SDK after %max_dart_sdk_retries% retries. 1>&2
|
||||
DEL "%engine_stamp%"
|
||||
EXIT 1
|
||||
)
|
||||
ECHO Error: Unable to update Dart SDK. Retrying... 1>&2
|
||||
timeout /t 5 /nobreak
|
||||
GOTO :do_sdk_update_and_snapshot
|
||||
|
||||
Reference in New Issue
Block a user