Unverified Commit 6ec7368a authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

[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
parent 16913b07
...@@ -56,6 +56,7 @@ $dartSdkZip = "$cachePath\$dartZipName" ...@@ -56,6 +56,7 @@ $dartSdkZip = "$cachePath\$dartZipName"
Try { Try {
Import-Module BitsTransfer Import-Module BitsTransfer
$ProgressPreference = 'SilentlyContinue'
Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip -ErrorAction Stop Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip -ErrorAction Stop
} }
Catch { Catch {
...@@ -70,6 +71,7 @@ Catch { ...@@ -70,6 +71,7 @@ Catch {
$ProgressPreference = $OriginalProgressPreference $ProgressPreference = $OriginalProgressPreference
} }
Write-Host "Expanding downloaded archive..."
If (Get-Command 7z -errorAction SilentlyContinue) { If (Get-Command 7z -errorAction SilentlyContinue) {
# The built-in unzippers are painfully slow. Use 7-Zip, if available. # The built-in unzippers are painfully slow. Use 7-Zip, if available.
& 7z x $dartSdkZip "-o$cachePath" -bd | Out-Null & 7z x $dartSdkZip "-o$cachePath" -bd | Out-Null
...@@ -78,6 +80,7 @@ If (Get-Command 7z -errorAction SilentlyContinue) { ...@@ -78,6 +80,7 @@ If (Get-Command 7z -errorAction SilentlyContinue) {
& 7za x $dartSdkZip "-o$cachePath" -bd | Out-Null & 7za x $dartSdkZip "-o$cachePath" -bd | Out-Null
} ElseIf (Get-Command Microsoft.PowerShell.Archive\Expand-Archive -errorAction SilentlyContinue) { } ElseIf (Get-Command Microsoft.PowerShell.Archive\Expand-Archive -errorAction SilentlyContinue) {
# Use PowerShell's built-in unzipper, if available (requires PowerShell 5+). # Use PowerShell's built-in unzipper, if available (requires PowerShell 5+).
$global:ProgressPreference='SilentlyContinue'
Microsoft.PowerShell.Archive\Expand-Archive $dartSdkZip -DestinationPath $cachePath Microsoft.PowerShell.Archive\Expand-Archive $dartSdkZip -DestinationPath $cachePath
} Else { } Else {
# As last resort: fall back to the Windows GUI. # As last resort: fall back to the Windows GUI.
......
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