Skip to content

fix: windows .cmd spawn requires shell: true#9

Closed
shishiv wants to merge 2 commits into
tintinweb:masterfrom
shishiv:fix/windows-cmd-spawn
Closed

fix: windows .cmd spawn requires shell: true#9
shishiv wants to merge 2 commits into
tintinweb:masterfrom
shishiv:fix/windows-cmd-spawn

Conversation

@shishiv
Copy link
Copy Markdown

@shishiv shishiv commented Apr 27, 2026

on windows, npm global binaries are .cmd wrappers. child_process.spawn can't execute them directly — needs shell: true. without it, trySpawn always returns false even when gitnexus is correctly installed and on PATH, so every session start/switch fires the "gitnexus not on PATH" warning.

five spawn sites affected (initial commit had four; fifth added in follow-up):

  • trySpawn (binary probe) in index.ts
  • status command spawn in index.ts
  • analyze command spawn in index.ts
  • runAugment in gitnexus.ts
  • McpClient.start() in mcp-client.tsmost critical: spawns gitnexus mcp to open the MCP server. without this fix, all gitnexus_* tools fail with ENOENT on windows even after the other four sites are patched.

fix is shell: process.platform === 'win32' on all five — no-op on mac/linux, fixes the issue on windows.

verified locally: probe returns exit: 0, version: 1.6.3 after the fix. MCP server handshake confirmed. augment enrichments also work now (were silently failing for the same reason).

tests

 ✓ tests/config.test.ts (4 tests) 9ms
 ✓ tests/gitnexus.test.ts (21 tests) 14ms
 ✓ tests/autocomplete.test.ts (3 tests) 38ms
 ✓ tests/mcp-client.test.ts (1 test) 12ms
 ✓ tests/augment-hook.test.ts (9 tests) 51ms
 ✓ tests/tools.test.ts (7 tests) 181ms
 ✓ tests/index-command.test.ts (1 test) 633ms

 Test Files  7 passed (7)
       Tests  46 passed (46)
    Duration  930ms

shishiv added 2 commits April 27, 2026 04:10
on windows, npm global binaries are .cmd wrappers.
child_process.spawn can't execute them directly without
shell: true — so trySpawn always returns false even when
gitnexus is correctly installed and on PATH.

this causes a false-positive 'gitnexus not on PATH' warning
on every session_start and session_switch.

four spawn sites patched:
- trySpawn (binary probe) in index.ts
- status command spawn in index.ts
- analyze command spawn in index.ts
- runAugment in gitnexus.ts

fix is shell: process.platform === 'win32' on all four —
no-op on mac/linux, fixes the issue on windows.

all 46 tests pass.
mcp-client.ts spawns `gitnexus mcp` to start the MCP server —
the most critical spawn site, missed by the initial fix.
without this, all gitnexus_* tools fail with ENOENT on windows
even after the other four spawn sites were patched.

this is the fifth spawn site. now all spawn calls have
shell: process.platform === 'win32'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant