Skip to content

Commit 71b8458

Browse files
authored
[ Tool ] Don't use .NET APIs in update_engine_version.ps1 (flutter#172974)
Powershell instances running in `ConstrainedLanguage` mode can't always access .NET APIs due to system administrator security configurations, including gWindows VMs. This change removes the use of `System.*` APIs from update_engine_version.ps1 in favor of dedicated Powershell APIs. Fixes flutter#172895
1 parent 83c7108 commit 71b8458

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

bin/internal/update_engine_version.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ if (![string]::IsNullOrEmpty($env:FLUTTER_PREBUILT_ENGINE_VERSION)) {
6161
}
6262

6363
# Write the engine version out so downstream tools know what to look for.
64-
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
65-
[System.IO.File]::WriteAllText("$flutterRoot/bin/cache/engine.stamp", $engineVersion, $utf8NoBom)
64+
Set-Content -Path $flutterRoot/bin/cache/engine.stamp -Value $engineVersion -Encoding Ascii
6665

6766
# The realm on CI is passed in.
68-
if ($Env:FLUTTER_REALM) {
69-
[System.IO.File]::WriteAllText("$flutterRoot/bin/cache/engine.realm", $Env:FLUTTER_REALM, $utf8NoBom)
67+
if ($env:FLUTTER_REALM) {
68+
Set-Content -Path $flutterRoot/bin/cache/engine.realm -Value $env:FLUTTER_REALM -Encoding Ascii
7069
} else {
71-
[System.IO.File]::WriteAllText("$flutterRoot/bin/cache/engine.realm", "", $utf8NoBom)
70+
Set-Content -Path $flutterRoot/bin/cache/engine.realm -Value "" -Encoding Ascii
7271
}

0 commit comments

Comments
 (0)