Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(installer): preserve Windows PowerShell 5.1 disk parsing (#8663)

ZIce7a3f29b4be75
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fd70e99629..d398907b2f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -843,7 +843,12 @@ jobs:
if: runner.os != 'Windows'
run: bash scripts/install.test.sh
- - name: Test PowerShell installer
+ - name: Test installer with Windows PowerShell 5.1
+ if: runner.os == 'Windows'
+ shell: powershell
+ run: ./scripts/install.ps1.test.ps1
+
+ - name: Test installer with PowerShell 7
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/install.ps1.test.ps1
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index b59e15e277..5627a9a25c 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -1,4 +1,4 @@
-# Multica installer for Windows — one command to get started.
+# Multica installer for Windows - one command to get started.
#
# Install CLI (default): connects to multica.ai
# irm https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.ps1 | iex
@@ -288,10 +288,10 @@ function Install-CliBinary {
}
Write-Ok "Checksum verified"
} else {
- Write-Warn "Could not find checksum entry for $releaseAsset — skipping verification."
+ Write-Warn "Could not find checksum entry for $releaseAsset - skipping verification."
}
} catch {
- Write-Warn "Could not download checksums.txt — skipping verification."
+ Write-Warn "Could not download checksums.txt - skipping verification."
}
Expand-Archive -Path (Join-Path $tmpDir "multica.zip") -DestinationPath $tmpDir -Force
diff --git a/scripts/install.ps1.test.ps1 b/scripts/install.ps1.test.ps1
index 89cd4899ac..d82eef456e 100644
--- a/scripts/install.ps1.test.ps1
+++ b/scripts/install.ps1.test.ps1
@@ -20,6 +20,7 @@ $ErrorActionPreference = "Stop"
$RepoRoot = Split-Path (Split-Path $PSCommandPath -Parent) -Parent
$InstallerPath = Join-Path $RepoRoot "scripts/install.ps1"
+$PowerShellPath = (Get-Process -Id $PID).Path
# install.ps1 resolves its default install directory from USERPROFILE at load
# time. Provide one so these tests also run on a non-Windows agent.
@@ -49,6 +50,8 @@ function Get-InstallerDefinitions {
# 1. install.ps1 must parse, and must no longer derive ports from .env
# ---------------------------------------------------------------------------
$parseErrors = $null
+# Parse the file directly: Windows PowerShell 5.1 reads BOM-less files as ANSI,
+# unlike PowerShell 7. Decoding as UTF-8 first would hide regressions like #8660.
[System.Management.Automation.Language.Parser]::ParseFile($InstallerPath, [ref]$null, [ref]$parseErrors) | Out-Null
if ($parseErrors) {
$parseErrors | ForEach-Object { Write-Host " $($_.Message) (line $($_.Extent.StartLineNumber))" }
@@ -135,7 +138,9 @@ $cases = @(
$runnerScript = Join-Path ([System.IO.Path]::GetTempPath()) "multica-install-ps1-case.ps1"
-# Each case runs in its own pwsh process: install.ps1 uses `exit` on failure, and
+# Each case runs in its own process using the current PowerShell host, so the
+# Windows PowerShell 5.1 suite cannot silently delegate its cases to PowerShell 7.
+# install.ps1 uses `exit` on failure, and
# a child process is also the only way to control the ambient environment
# cleanly rather than inheriting a CI runner's PORT.
@'
@@ -269,7 +274,7 @@ foreach ($case in $cases) {
}
try {
- $output = & pwsh -NoProfile -File $runnerScript -InstallerPath $InstallerPath -WorkDir $workDir -ProbeLog $probeLog 2>&1
+ $output = & $PowerShellPath -NoProfile -File $runnerScript -InstallerPath $InstallerPath -WorkDir $workDir -ProbeLog $probeLog 2>&1
$exitCode = $LASTEXITCODE
} finally {
foreach ($key in $portVars) {