Skip to content

fix: add shell option for Windows .cmd wrapper resolution#5

Closed
51ck0n1n3t33n wants to merge 1 commit intoopenai:mainfrom
51ck0n1n3t33n:fix/windows-spawnsync-shell
Closed

fix: add shell option for Windows .cmd wrapper resolution#5
51ck0n1n3t33n wants to merge 1 commit intoopenai:mainfrom
51ck0n1n3t33n:fix/windows-spawnsync-shell

Conversation

@51ck0n1n3t33n
Copy link
Copy Markdown

Bug

On Windows, /codex:setup reports Codex CLI and npm as "not found" even when both are properly installed globally via npm.

Root Cause

spawnSync("codex", ...) in process.mjs cannot resolve .cmd wrappers on Windows without shell: true. Node.js on Windows requires either the explicit .cmd extension or shell: true to find globally installed npm binaries. This is a well-documented Node.js behavior: https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows

Fix

Conditionally set shell: process.platform === "win32" in the runCommand spawnSync options. This only enables shell resolution on Windows, avoiding any behavioral changes on macOS/Linux.

Tested On

  • Windows 11
  • Node.js v24.14.0
  • Codex CLI v0.117.0
  • Claude Code v2.1.87

On Windows, Node.js spawnSync cannot resolve .cmd wrappers (like codex.cmd
and npm.cmd installed by npm global) without shell: true. This causes
binaryAvailable() to return ENOENT for codex and npm even when they are
properly installed.

Conditionally enables shell: true on win32 only.
@51ck0n1n3t33n 51ck0n1n3t33n requested a review from a team March 30, 2026 19:59
@dkundel-openai
Copy link
Copy Markdown
Collaborator

Closing as duplicate of #13. Thanks for the contribution

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.

2 participants