Fix Bun Windows build script compatibility#1544
Open
Charlie-El wants to merge 1 commit into
Open
Conversation
Move the long package build pipeline into a bash script so Bun's Windows script parser no longer sees subshell redirections like '( git ... ) > dist/.version'. Write version files via a dedicated helper and add regression coverage for the shell pattern. When setup runs on Windows from a non-ASCII bun.exe path, use a temporary ASCII-path bun copy for --compile and clean it up afterward.
Author
|
This overlaps with #1531 on the
Manual verification on Windows Git Bash:
Both completed successfully. |
5 tasks
shelman09
pushed a commit
to Namleh-Studios/gstack
that referenced
this pull request
May 19, 2026
…s Bun compat (garrytan#1538, garrytan#1537, garrytan#1530, garrytan#1457, garrytan#1561) Bun's Windows shell parser rejects multiple constructs the inline package.json build chain used: brace groups `{ cmd; }`, subshells with redirection `( git ... ) > path/.version`, and (in Bun 1.3.x) subshells near redirections in general. Every Windows install + every auto-upgrade since v1.34.2.0 has failed on `bun run build`. Extracts the build chain to scripts/build.sh and the .version writes to scripts/write-version-files.sh. POSIX-portable, no Bun shell parsing involved. Also adds Windows-specific bun.exe handling for non-ASCII PATHs (a separate Windows footgun where Bun's --compile fails when the binary lives under a path with non-ASCII chars). Updates test/build-script-shell-compat.test.ts to assert the new shape: no subshells with redirections anywhere in the build chain, and build delegates to scripts/build.sh which delegates .version writes. Contributed by @Charlie-El via garrytan#1544. Supersedes garrytan#1531 (@scarson, fixed in build helper), garrytan#1480 (@mikepsinn, partial overlap), garrytan#1460 (@realcarsonterry, brace-group fix subsumed) — credit retained. Closes garrytan#1538, garrytan#1537, garrytan#1530, garrytan#1457, garrytan#1561. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes Windows setup/build failures with Bun 1.3.x where package scripts containing subshell redirections fail with:
Subshells with redirections are currently not supportedThis PR moves the long build pipeline out of
package.jsonand into a Bash script, so Bun no longer has to parse complex shell syntax. It also handles a related Windows issue wherebun build --compilecan fail whenbun.exeis installed under a non-ASCII user path, such as a Windows username containing Chinese characters.What changed
package.jsonbuild command withbash scripts/build.sh.scripts/build.shto run the full build pipeline under Bash instead of Bun's package-script shell parser.scripts/write-version-files.shto write.versionfiles without( git ... ) > file.setupso Windows installs can temporarily copybun.exeto an ASCII-only path forbun build --compile, then clean it up afterward.test/build-script-shell-compat.test.tsto guard against reintroducing subshell redirections in the build script.Why
On Windows Git Bash with Bun 1.3.x,
bun run buildfailed before compilation with:The failing pattern was:
After removing that pattern, I also reproduced a second Windows-specific issue where
bun build --compilefailed when Bun was installed under a non-ASCII user path:Using an ASCII-path temporary Bun copy allowed
bun build --compileto complete.Relationship to related PRs
This overlaps with #1531 on the
.versionredirection failure, but takes a broader approach:scripts/build.sh, so Bun does not parse the long shell command at all..versionwrites in a helper script.bun.exepaths, which reproduced locally with a Chinese Windows username andbun build --compile.It is also related to #1480, #1540, and #1460. The main additional coverage here is the non-ASCII Windows user path case plus verified end-to-end
setup --host codexbehavior.Test Plan
bash -n scripts/build.sh scripts/write-version-files.sh setupbun test test/build-script-shell-compat.test.tsbun run buildbash ./setup --host codexcompletes on Windows Git Bash.