From 6ec7368a15d8e11fcf3df3129fc61797a924b84f Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 3 Feb 2021 11:37:40 -0800 Subject: [PATCH] [win] Suppress Powershell download/extraction visualization progress bar. (#75335) This is to avoid Windows Command Prompt window from changing the fonts and colors as it transitions into Powershell with its drawing progress bar. Instead simple console text will be printed: ``` C:\src\f\flutter>bin\flutter doctor Checking Dart SDK version... Downloading Dart SDK from Flutter engine 2c144c3eeb4b25fd78b90dd3e2a24c36f4201021... Expanding downloaded archive... Building flutter tool... ... ``` Fixes https://github.com/flutter/flutter/issues/74864 --- bin/internal/update_dart_sdk.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/internal/update_dart_sdk.ps1 b/bin/internal/update_dart_sdk.ps1 index 0166dc8e83..033fecc6f8 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 { @@ -70,6 +71,7 @@ Catch { $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 +80,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.