fix(core): extract zips with tar on Windows instead of Expand-Archive#36035
Closed
YayoRazo wants to merge 1 commit into
Closed
fix(core): extract zips with tar on Windows instead of Expand-Archive#36035YayoRazo wants to merge 1 commit into
YayoRazo wants to merge 1 commit into
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
|
For context: this differs from the earlier attempt in #25396, which still spawned |
PowerShell's Microsoft.PowerShell.Archive module fails to autoload when powershell.exe is spawned from the Bun-compiled binary, breaking zip extraction for the ripgrep download and LSP server installs on Windows. Windows ships bsdtar as tar.exe since Windows 10 1803 (Bun requires 1809+), and it extracts zip archives natively, so both call sites now use the same tar path that macOS/Linux already use for tar.gz. The destination directory is created explicitly (Expand-Archive did it implicitly), and the unescaped single-quote interpolation in extractZip goes away with the PowerShell command string. Fixes #24291
YayoRazo
force-pushed
the
fix-windows-zip-tar
branch
from
July 9, 2026 07:54
ef4a637 to
bf6dd83
Compare
CreatorGhost
added a commit
to CreatorGhost/TheCode
that referenced
this pull request
Jul 12, 2026
Ported from upstream anomalyco#36035.
CreatorGhost
added a commit
to CreatorGhost/TheCode
that referenced
this pull request
Jul 12, 2026
…#18) Ported from upstream anomalyco#36035.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24291
Type of change
What does this PR do?
On Windows, zip extraction (the ripgrep download and LSP server installs) shells out to PowerShell's
Expand-Archive. When opencode runs as the Bun-compiled binary,powershell.exefails to autoloadMicrosoft.PowerShell.Archive("the module could not be loaded"), which breaks theskillandglobtools.The fix swaps both PowerShell call sites for Windows' built-in
tar.exe. Why this works: Windows has shipped bsdtar since Windows 10 1803 and Bun requires 1809+, sotaris always present on any machine that can run opencode, and bsdtar reads zip archives natively — no PowerShell process, no module autoload, so the Bun environment issue can't be hit. This also matches the tar.gz extraction path already used on macOS/Linux.packages/core/src/ripgrep/binary.ts: zip and tar.gz now share onetarinvocation (-xfvs-xzf)packages/opencode/src/util/archive.ts: same swap; adds an explicit mkdir for the destination (Expand-Archivecreated it implicitly,tar -Cdoes not) and removes the single-quote interpolation that broke on paths containing'How did you verify your code works?
tar -xf <zip> -C <dest>invocation; re-extracted over existing files to confirm overwrite parity with-Force; exit 0 and correct contents both times.bun run typecheckpasses inpackages/coreandpackages/opencode; full pre-push turbo typecheck green (30/30).Screenshots / recordings
Not a UI change.
Checklist