fix(build): isolate subshell+redirect to bash helper for Windows#1616
Open
agswindow wants to merge 1 commit into
Open
fix(build): isolate subshell+redirect to bash helper for Windows#1616agswindow wants to merge 1 commit into
agswindow wants to merge 1 commit into
Conversation
16fe9c6 to
e4dea3f
Compare
Bun Shell on Windows doesn't reliably handle `( ... ) > file` (subshell with stdout redirect) -- see oven-sh/bun#11066, #11968. The four such constructs in `package.json`'s `build`: ( git rev-parse HEAD 2>/dev/null || true ) > {browse,design,make-pdf}/dist/.version (rm -f .*.bun-build || true) silently break the `&&` chain mid-build on Windows. Symptoms: stale binaries with no `.version` stamp, leftover `.bun-build` temp files, and the post-build `chmod` step never runs. Move the four constructs into a new `scripts/stamp-versions.sh` -- same shell syntax, but invoked via `bash` so they never enter Bun Shell. Matches the existing pattern in `browse/scripts/build-node-server.sh` (which exists for a related bun-on-Windows reason). Update `test/build-script-shell-compat.test.ts` (D-1460): the assertion now accepts inline subshells OR a reference to `scripts/stamp-versions.sh`, with a file-existence guard so a rename/move can't silently break stamping. The anti-brace-group constraint is preserved. Verified on Windows 11 (bun 1.3.11): `bun run build` completes, all 5 binaries are rebuilt + `.version` stamped + temp files cleaned. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e4dea3f to
60f114c
Compare
Contributor
|
Looks like this overlaps the canonical Windows build fix already in maintainer wave #1594. That wave closes #1538/#1537/#1530/#1457/#1561 and replaces the package build chain with If there is still a gap after #1594, the clean follow-up would be against that branch/main with the specific missing Windows behavior rather than landing a parallel build-chain shape here. |
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.
Problem
On Windows,
bun run buildsilently breaks mid-chain. Bun Shell doesn't reliably handle( ... ) > file(subshell with stdout redirect) — see oven-sh/bun#11066, #11968. The four offending constructs inpackage.json'sbuild:cause the
&&chain to break. Symptoms on Windows: stale binaries with no.versionstamp (confusingfind-browsestale detection), leftover.bun-buildtemp files, and thechmodstep never runs.Fix
Move the four constructs into a new
scripts/stamp-versions.sh— same shell syntax, but invoked viabashso they never enter Bun Shell. Matches the existing pattern inbrowse/scripts/build-node-server.sh.Also updates
test/build-script-shell-compat.test.ts(D-1460): the assertion now accepts inline subshells OR a reference toscripts/stamp-versions.sh, with a file-existence guard so a rename/move can't silently break stamping. The anti-brace-group constraint is preserved.Verification
Tested on Windows 11 (bun 1.3.11). Before fix:
.versionfiles 9 days stale despite repo on026751e(v1.40.0.0); browse binaries last built 7 days ago. After fix: 5 binaries rebuilt +.versionstamped to HEAD SHA + temp files cleaned, no errors.bun test test/build-script-shell-compat.test.ts: 2/2 pass.Out of scope (flagged during adversarial review)
bun run build(make-pdf-gate.ymlhas Windows commented out;windows-free-tests.ymlonly runsbuild-node-server.sh). End-to-end Bun-on-Windows path remains uncovered — happy to follow up.bashdependency: same as existingbuild-node-server.sh; could be removed via TS rewrite if preferred..versionsemantics unchanged: empty file on non-git install, HEAD SHA on dirty tree. Both pre-existing.scripts/stamp-versions.shitself (would need tmpdir + subprocess). Static checks here pin invocation shape and helper presence, not runtime correctness — happy to add if preferred.Side note:
.gitignorematchesbin/gstack-global-discover(no extension) but Windows bun producesbin/gstack-global-discover.exe. Happy to file separately.🤖 Generated with Claude Code