Repository navigation
fix(create-void): spawn package managers with a shell on Windows - #231
Merged
Brooooooklyn merged 1 commit intoJun 29, 2026
Conversation
Brooooooklyn
approved these changes
Jun 29, 2026
Brooooooklyn
deleted the
06-25-fix_create-void_spawn_package_managers_with_a_shell_on_windows
branch
June 29, 2026 16:15
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
create-voidis unusable on Windows: scaffolding a project always fails right after the project directory is created.run()inpackages/create-void/src/pm.tsspawns the package manager (npm install,npx void init, and the pnpm/yarn/bun equivalents) vianode:child_processwithout theshelloption. On Windows thenpm/npx/pnpm/yarn/bunxentry points are.cmd/.ps1shims thatspawn()cannot resolve without a shell, so the child emits anerrorevent withENOENT.run()rejects, and because the directory +package.jsonare already written, the user is left with a half-created project and a stack trace.Fix
Pass
shell: process.platform === 'win32'tospawn:On Windows the command now runs through
cmd.exe, which resolves the.cmdshim viaPATHEXT. On macOS/Linux behavior is unchanged (shellstays off).Why this is safe (no injection surface)
shell: trueonly becomes a shell-injection risk when untrusted input reaches the command string, which does not happen here. Everyargvvalue is a hardcoded literal:pmInstall()returns[pm, 'install']andpmExec()returns['npx']/['pnpm','exec']/ etc., wherepmis a fixed enum fromdetectPM(). The only user-controlled value, the target directory, is passed as thecwdspawn option, not interpolated into the command line.A comment in the code records "argv must stay literal" as the invariant; if a dynamic argument is ever added, switch to
cross-spawn(or escape) at that point.Alternatives considered
cross-spawn(the approachcreate-viteuses) resolves.cmdshims and escapes arguments without a shell. Its real value is injection-safe escaping of dynamic arguments, which this scaffolder doesn't have, so adding a runtime dependency (plus its 5 transitive deps and bundleronlyBundleupkeep) to spawn a fixed command wasn't worth it here.