fix: use exec/spawn with shell for Windows .cmd compatibility#20
Open
0Prime wants to merge 1 commit into
Open
Conversation
execFile and spawn without shell: true fail with EINVAL on Windows
when the pi binary resolves to a .cmd file (e.g. node_modules/.bin/pi.cmd).
- execFile → exec with forward-slash path conversion
- spawn → spawn with { shell: true }
Fixes #<TBD>
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
Clicking the Pi icon in the activity bar to open the Packages sidebar shows:
On Windows,
findPiBinary()resolves to a.cmdfile (e.g.node_modules/.bin/pi.cmd).execFileandspawnwithout{ shell: true }cannot execute.cmdbatch scripts directly, producingspawn EINVAL.Fix
execFile→execwith forward-slash path conversion (bin.split('\\').join('/'))spawn→spawnwith{ shell: true }This is a known Windows + Node.js ≥ 20.14 issue (Electron 30 breaking change for
.bat/.cmdexecution).Fixes #19
Verification
pnpm fmtpassespnpm typecheckpasses