Skip to content

Commit 5f9cf45

Browse files
fix(install.ps1): ASCII-only so it parses on Windows PowerShell 5.1
install.ps1 had no BOM and used a few non-ASCII characters (em dash, ellipsis, right arrow) in comments and messages. Windows PowerShell 5.1 - the default shell on Windows 10 and preinstalled on Windows 11 - reads a BOM-less file as the system ANSI codepage, not UTF-8, so those multi-byte characters corrupt the token stream and the whole script fails to parse (verified on real PS 5.1). This is a pre-existing issue (the characters predate this PR) that CI doesn't catch because the Pester job runs under pwsh (PowerShell 7, UTF-8 by default). Replacing the three characters with ASCII equivalents (-, ..., ->) makes the installer parse and run on PS 5.1 while keeping pwsh behavior identical. Also removes the now-obsolete "integrity verification deferred" NOTE comment: the sibling PR #942 implements that verification and removes the same block, so deleting it here too keeps the two PRs mergeable in either order with no conflict. Same transliteration is applied verbatim in #942. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
1 parent d23fc1a commit 5f9cf45

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

‎install.ps1‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Mirrors ./install (the bash installer for macOS/Linux): it downloads the
55
# Bun-compiled standalone executable (altimate.exe) from GitHub releases and
6-
# drops it in %USERPROFILE%\.altimate\bin — it does NOT depend on npm/Node.
6+
# drops it in %USERPROFILE%\.altimate\bin - it does NOT depend on npm/Node.
77
#
88
# Usage:
99
# powershell -c "irm https://www.altimate.sh/install.ps1 | iex"
@@ -64,8 +64,8 @@ if ($Help) {
6464
exit 0
6565
}
6666

67-
# A single P/Invoke type carries both native calls we need — the AVX2 CPU probe
68-
# (kernel32) and the PATH-change broadcast (user32) — so we Add-Type once instead
67+
# A single P/Invoke type carries both native calls we need - the AVX2 CPU probe
68+
# (kernel32) and the PATH-change broadcast (user32) - so we Add-Type once instead
6969
# of compiling a throwaway type per call site.
7070
function Initialize-Native {
7171
if (-not ("Win32.AltimateNative" -as [type])) {
@@ -101,21 +101,21 @@ function Test-Avx2 {
101101
Initialize-Native
102102
return [bool][Win32.AltimateNative]::IsProcessorFeaturePresent(40)
103103
} catch {
104-
# If detection fails, assume no AVX2 and fall back to the baseline build —
104+
# If detection fails, assume no AVX2 and fall back to the baseline build -
105105
# the baseline binary runs everywhere, an AVX2 binary on a non-AVX2 CPU crashes.
106106
return $false
107107
}
108108
}
109109

110110
# ---------------------------------------------------------------------------
111-
# Resolve version (once) — latest tag or a pinned release
111+
# Resolve version (once) - latest tag or a pinned release
112112
# ---------------------------------------------------------------------------
113113
if ([string]::IsNullOrWhiteSpace($Version)) {
114114
$useLatest = $true
115115
# The download below resolves "latest" server-side (releases/latest/download),
116116
# so this API call only feeds the version-string display and the
117117
# already-installed short-circuit. A transient api.github.com blip or the
118-
# unauthenticated rate limit (60/hr/IP) must NOT abort the install — retry a
118+
# unauthenticated rate limit (60/hr/IP) must NOT abort the install - retry a
119119
# few times, then proceed without the version string.
120120
$specificVersion = ""
121121
for ($attempt = 1; $attempt -le 3; $attempt++) {
@@ -130,7 +130,7 @@ if ([string]::IsNullOrWhiteSpace($Version)) {
130130
if ($attempt -lt 3) { Start-Sleep -Seconds $attempt }
131131
}
132132
if ([string]::IsNullOrWhiteSpace($specificVersion)) {
133-
Write-Muted "Could not resolve the latest version from GitHub (API unavailable) — installing the latest release anyway."
133+
Write-Muted "Could not resolve the latest version from GitHub (API unavailable) - installing the latest release anyway."
134134
# Reset to $null (not ""): the already-installed short-circuit below compares
135135
# $installedVersion -eq $specificVersion. If the version probe of a missing or
136136
# corrupt binary also yields "", an "" -eq "" match would falsely report
@@ -200,12 +200,6 @@ function Install-Target {
200200
$zipPath = Join-Path $tmpDir $filename
201201

202202
try {
203-
# NOTE: integrity verification (SHA256/signature) of the archive is
204-
# intentionally deferred to match the bash installer's posture — both rely
205-
# on HTTPS from github.com release assets. Releases do not currently publish
206-
# a checksums file; adding one + verifying it in both installers is tracked
207-
# as a follow-up. See PR #930 discussion.
208-
#
209203
# Prefer curl.exe (ships with Windows 10 1803+) for a fast download with
210204
# --fail so HTTP errors don't write an error page to disk; fall back to
211205
# Invoke-WebRequest where curl.exe is unavailable.
@@ -226,7 +220,7 @@ function Install-Target {
226220

227221
# Windows locks a running .exe, so `altimate upgrade` (which re-runs this
228222
# installer) can't overwrite the binary that is currently executing. Windows
229-
# *does* allow renaming a running exe — move the old one aside first, then
223+
# *does* allow renaming a running exe - move the old one aside first, then
230224
# drop the new one in. Best-effort cleanup of the stale copy afterward.
231225
if (Test-Path $InstalledBinary) {
232226
$stale = "$InstalledBinary.old"
@@ -253,7 +247,7 @@ if (-not $needsBaseline) {
253247
& $InstalledBinary --version *> $null
254248
$code = $LASTEXITCODE
255249
if ($code -eq 3221225501 -or $code -eq 1073741795 -or $code -eq -1073741795) {
256-
Write-Muted "CPU lacks AVX2 — reinstalling the baseline build"
250+
Write-Muted "CPU lacks AVX2 - reinstalling the baseline build"
257251
Install-Target -Baseline:$true
258252
}
259253
}

0 commit comments

Comments
 (0)