fix: avoid shell:true deprecation on Windows - #725
Open
fscfede-beep wants to merge 2 commits into
Open
Conversation
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Explicit ComSpec handling is the right Windows boundary: .cmd shims still need command-processor semantics, but the child-process API no longer relies on shell:true. Keeping taskkill direct also avoids MSYS argument rewriting, and exit 128 removes the locale dependency.
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 #717.
Related: #708, #525.
shell: trueon Windowsnode/npm/codexshim-style probes through an explicitComSpec /d /s /c call ...invocation withshell: falsecodex app-serverstartuptaskkilldirectly withshell: false, avoiding Git Bash/MSYS conversion of/PID,/T, and/Ftaskkillexit 128 as an already-stopped process, so cleanup does not depend on English error textThis avoids Node's DEP0190 warning without breaking
.cmdshims such asnpmon Windows. It also addresses the shell/argument-conversion root cause reported in #708 and #525 and makes the already-deadtaskkillpath locale-independent.Validation
On Windows 11 / Node 26.3.1:
node --trace-deprecation plugins/codex/scripts/codex-companion.mjs setup --jsonstderr_bytes=0taskkill /PID 999999 /T /FreachestaskkillasC:/Program Files/Git/PIDand exits 1taskkill /PID 999999 /T /Freturns localized SpanishERROR: no se encontró el proceso "999999".with exit 128node --test tests/process.test.mjs tests/commands.test.mjs tests/bump-version.test.mjs-> 14 passed, 0 failednode --check plugins/codex/scripts/lib/process.mjsnode --check plugins/codex/scripts/lib/app-server.mjsgit diff --checkI also verified on the same host that direct
spawnSync(..., { shell: false })works for.exebinaries but returnsEINVALfor an absolutenpm.cmd, which is why the patch keeps explicitcmd.exehandling for Windows command shims instead of globally assuming every command is directly executable.