fix: replace Bun.$ shell calls with Bun.spawn for Windows compatibility#43
Merged
Conversation
Bun.$ template literals hang on Windows because the shell subprocess doesn't properly close stdin/stdout pipes, causing deadlocks. This blocks the MCP server thread and freezes Claude Code / Cursor. Replace all Bun.$ calls with Bun.spawn (array-based, no shell) which handles pipes correctly on all platforms. Affected tools: review_context, check (via git-files.ts), plugin install, and upgrade commands.
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
Bun.$template literal shell calls withBun.spawn()across 4 filesBun.$hangs indefinitely on Windows because the shell subprocess doesn't properly close stdin/stdout pipes, deadlocking the MCP server thread and freezing Claude Code / CursorBun.spawn()passes commands as arrays (no shell involved) and handles pipes correctly on all platformsAffected files
src/engine/git-files.tsrunGit()helper; replaced 4Bun.$git callssrc/helpers/git.ts$git diff && git diff --cached`` (shell&&) with parallel `Bun.spawn` + `Promise.all`src/helpers/plugin-install.tsrun()helper; replacedclaudeCLI andtarshell callssrc/commands/upgrade.ts$npm install -g archgate@latest`` withBun.spawnRoot cause
MCP tools
review_contextandcheckcall git functions ingit-files.ts. On Windows,Bun.$spawns a shell subprocess that never properly closes its pipes, causing theawait .text()to hang forever. Since the MCP server runs in a single async thread, this blocks all further tool calls and freezes the host (Claude Code / Cursor).list_adrswas unaffected because it only usesreaddirSyncandBun.file()— no shell calls.What was left unchanged
helpers/git.tsinstallGit()still uses$forbrew install gitandapt-get install git— these are platform-guarded (only run on macOS/Linux; Windows throws before reaching them)Test plan
archgate checkworks on Windows (was hanging before)review_contextMCP tool responds on Windows (was hanging before)list_adrsstill works (was unaffected, sanity check)archgate checkstill works on macOS/Linux (regression check)bun typecheck— passes cleanly