Last active
February 3, 2021 17:08
-
-
Save aam/09e5b7388879ce969a1dca03848c4520 to your computer and use it in GitHub Desktop.
Suppress progress indication that could lead to strange font/color changes to Windows cmd shell session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bin/internal/update_dart_sdk.ps1 b/bin/internal/update_dart_sdk.ps1 | |
index 0166dc8e83..f38bec2d95 100644 | |
--- a/bin/internal/update_dart_sdk.ps1 | |
+++ b/bin/internal/update_dart_sdk.ps1 | |
@@ -56,6 +56,7 @@ $dartSdkZip = "$cachePath\$dartZipName" | |
Try { | |
Import-Module BitsTransfer | |
+ $ProgressPreference = 'SilentlyContinue' | |
Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip -ErrorAction Stop | |
} | |
Catch { | |
@@ -66,10 +67,10 @@ Catch { | |
# https://github.com/flutter/flutter/issues/37789 | |
$OriginalProgressPreference = $ProgressPreference | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri $dartSdkUrl -OutFile $dartSdkZip | |
$ProgressPreference = $OriginalProgressPreference | |
} | |
+Write-Host "Expanding downloaded archive..." | |
If (Get-Command 7z -errorAction SilentlyContinue) { | |
# The built-in unzippers are painfully slow. Use 7-Zip, if available. | |
& 7z x $dartSdkZip "-o$cachePath" -bd | Out-Null | |
@@ -78,6 +79,7 @@ If (Get-Command 7z -errorAction SilentlyContinue) { | |
& 7za x $dartSdkZip "-o$cachePath" -bd | Out-Null | |
} ElseIf (Get-Command Microsoft.PowerShell.Archive\Expand-Archive -errorAction SilentlyContinue) { | |
# Use PowerShell's built-in unzipper, if available (requires PowerShell 5+). | |
+ $global:ProgressPreference='SilentlyContinue' | |
Microsoft.PowerShell.Archive\Expand-Archive $dartSdkZip -DestinationPath $cachePath | |
} Else { | |
# As last resort: fall back to the Windows GUI. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment