Skip to content

Commit 000c79e

Browse files
authored
Update installer version to 1.2.0 and improve output
1 parent faabd7a commit 000c79e

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

deepstudio/xtester/install.ps1

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ param(
2424

2525
$ErrorActionPreference = "Stop"
2626

27-
$Script:InstallerVersion = "1.1.0"
27+
$Script:InstallerVersion = "1.2.0"
28+
29+
# Force UTF-8 console output so winget's progress glyphs and other tool output
30+
# are not rendered as mojibake in legacy code-page consoles.
31+
try {
32+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
33+
$OutputEncoding = [System.Text.Encoding]::UTF8
34+
} catch { }
2835

2936
function Info([string]$Message) { Write-Host " $Message" -ForegroundColor Cyan }
3037
function Success([string]$Message) { Write-Host " OK $Message" -ForegroundColor Green }
@@ -399,8 +406,21 @@ function Install-PythonViaWinget {
399406
Invoke-Step "Installing Python 3.12 via winget (Python.Python.3.12)" {
400407
# Use --scope user so we do not require an elevation prompt; winget returns
401408
# non-zero for "already installed" too, so we tolerate any non-fatal exit.
409+
# --disable-interactivity suppresses winget's animated progress bar so the
410+
# console is not flooded with redraw lines (which can also render as
411+
# mojibake on legacy code pages).
402412
& $winget.Source install -e --id Python.Python.3.12 --scope user `
403-
--accept-source-agreements --accept-package-agreements --silent 2>&1 | ForEach-Object { Write-Host " $_" }
413+
--accept-source-agreements --accept-package-agreements --silent `
414+
--disable-interactivity 2>&1 | ForEach-Object {
415+
$line = [string]$_
416+
# Drop empty/whitespace lines and progress redraw lines (block glyphs,
417+
# carriage-return progress percentages, and MB/KB transfer counters).
418+
if ([string]::IsNullOrWhiteSpace($line)) { return }
419+
if ($line -match '^[\s\u2580-\u259F\u2588-\u259B█▒▓░\-\\|/]+\s*\d+\s*%\s*$') { return }
420+
if ($line -match '^[\s\u2580-\u259F\u2588-\u259B█▒▓░\-\\|/]+\s*\d[\d.,]*\s*(KB|MB|GB)\s*/\s*\d') { return }
421+
if ($line -match '^[\s\-\\|/]+$') { return }
422+
Write-Host " $line"
423+
}
404424
if ($LASTEXITCODE -ne 0) {
405425
Warn "winget exited with code $LASTEXITCODE (this can mean 'already installed' or 'no upgrade needed' and is often safe to ignore)."
406426
}

0 commit comments

Comments
 (0)