Commit edb61cb2 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Add error handling to batch script (#10007)

parent 5be2fb0b
......@@ -80,9 +80,9 @@ GOTO :after_subroutine
:do_sdk_update_and_snapshot
ECHO Checking Dart SDK version...
CALL PowerShell.exe -ExecutionPolicy Bypass -Command "& '%FLUTTER_ROOT%/bin/internal/update_dart_sdk.ps1'"
SET exit_code=%ERRORLEVEL%
IF %exit_code% NEQ 0 (
ECHO Error: Unable to update Dart SDK. Retrying... Press Ctrl+C to abort.
IF "%ERRORLEVEL%" NEQ "0" (
ECHO Error: Unable to update Dart SDK. Retrying...
timeout /t 5 /nobreak
GOTO :do_sdk_update_and_snapshot
)
......@@ -104,11 +104,24 @@ GOTO :after_subroutine
SET PUB_ENVIRONMENT=%PUB_ENVIRONMENT%:flutter_bot
:not_on_bot
SET PUB_ENVIRONMENT=%PUB_ENVIRONMENT%:flutter_install
:retry_pub_upgrade
CALL "%pub%" upgrade --verbosity=error --no-packages-dir
IF "%ERRORLEVEL%" NEQ "0" (
ECHO Error: Unable to 'pub upgrade' flutter tool. Retrying...
timeout /t 5 /nobreak
GOTO :retry_pub_upgrade
)
ENDLOCAL
POPD
:retry_dart_snapshot
CALL "%dart%" --snapshot="%snapshot_path%" --packages="%flutter_tools_dir%\.packages" "%script_path%"
IF "%ERRORLEVEL%" NEQ "0" (
ECHO Error: Unable to create dart snapshot for flutter tool. Retrying...
timeout /t 5 /nobreak
GOTO :retry_dart_snapshot
)
>"%stamp_path%" ECHO %revision%
REM Exit Subroutine
......@@ -120,8 +133,13 @@ CALL "%dart%" %FLUTTER_TOOL_ARGS% "%snapshot_path%" %*
SET exit_code=%ERRORLEVEL%
REM The VM exits with code 253 if the snapshot version is out-of-date.
IF /I "%exit_code%" EQU "253" (
IF "%exit_code%" EQU "253" (
CALL "%dart%" --snapshot="%snapshot_path%" --packages="%flutter_tools_dir%\.packages" "%script_path%"
SET exit_code=%ERRORLEVEL%
IF "%exit_code%" EQU "253" (
ECHO Error: Unable to create dart snapshot for flutter tool.
EXIT /B %exit_code%
)
CALL "%dart%" %FLUTTER_TOOL_ARGS% "%snapshot_path%" %*
SET exit_code=%ERRORLEVEL%
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment