mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] exit script if powershell version detection fails (#64773)
This commit is contained in:
parent
b5ed913ecc
commit
1021a52f13
@ -92,7 +92,13 @@ GOTO :after_subroutine
|
||||
SET update_dart_bin=%FLUTTER_ROOT%/bin/internal/update_dart_sdk.ps1
|
||||
REM Escape apostrophes from the executable path
|
||||
SET "update_dart_bin=!update_dart_bin:'=''!"
|
||||
%powershell_executable% -ExecutionPolicy Bypass -Command "Unblock-File -Path '%update_dart_bin%'; & '%update_dart_bin%'"
|
||||
REM PowerShell command must have exit code set in order to prevent all non-zero exit codes from being translated
|
||||
REM into 1. The exit code 2 is used to detect the case where the major version is incorrect and there should be
|
||||
REM no subsequent retries.
|
||||
%powershell_executable% -ExecutionPolicy Bypass -Command "Unblock-File -Path '%update_dart_bin%'; & '%update_dart_bin%'; exit $LASTEXITCODE;"
|
||||
IF "%ERRORLEVEL%" EQU "2" (
|
||||
EXIT 1
|
||||
)
|
||||
IF "%ERRORLEVEL%" NEQ "0" (
|
||||
ECHO Error: Unable to update Dart SDK. Retrying...
|
||||
timeout /t 5 /nobreak
|
||||
|
@ -29,7 +29,9 @@ $psMajorVersionLocal = $PSVersionTable.PSVersion.Major
|
||||
if ($psMajorVersionLocal -lt $psMajorVersionRequired) {
|
||||
Write-Host "Flutter requires PowerShell $psMajorVersionRequired.0 or newer."
|
||||
Write-Host "See https://flutter.dev/docs/get-started/install/windows for more."
|
||||
return
|
||||
Write-Host "Current version is $psMajorVersionLocal."
|
||||
# Use exit code 2 to signal that shared.bat should exit immediately instead of retrying.
|
||||
exit 2
|
||||
}
|
||||
|
||||
if ((Test-Path $engineStamp) -and ($engineVersion -eq (Get-Content $engineStamp))) {
|
||||
|
Loading…
Reference in New Issue
Block a user