Skip to content

Commit 1b94f1c

Browse files
Rick Valdesclaude
andcommitted
Use tar for extraction in the Windows installer
Expand-Archive is very slow on Windows ARM for the ~62 MB many-file CLI zip — slow enough that a fresh install can appear to hang for minutes and get killed mid-extract, leaving no binary. tar (bsdtar, shipped on Windows 10+) extracts the same archive in seconds; Expand-Archive remains the fallback. install.ps1 is fetched from main, so this takes effect immediately for the one-liner without a re-release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0ba0ed1 commit 1b94f1c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

install.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,16 @@ try {
9797
# would then install them too.
9898
$extract = Join-Path $tmp 'extract'
9999
New-Item -ItemType Directory -Force -Path $extract | Out-Null
100-
Expand-Archive -Path $pkg -DestinationPath $extract -Force
100+
# Prefer tar (bsdtar, shipped on Windows 10+): Expand-Archive is very slow on
101+
# ARM for a large many-file zip and can take minutes. Fall back to
102+
# Expand-Archive where tar is unavailable.
103+
$tar = Get-Command tar.exe -ErrorAction SilentlyContinue
104+
if ($tar) {
105+
& $tar.Source -xf $pkg -C $extract
106+
if ($LASTEXITCODE -ne 0) { Expand-Archive -Path $pkg -DestinationPath $extract -Force }
107+
} else {
108+
Expand-Archive -Path $pkg -DestinationPath $extract -Force
109+
}
101110
$exeSource = Get-ChildItem -Path $extract -Recurse -Filter "$App.exe" | Select-Object -First 1
102111
if (-not $exeSource) { Fail "archive does not contain $App.exe" }
103112

0 commit comments

Comments
 (0)