Repository navigation
fix: spawn Windows .cmd shims through tinyexec's normalizeSpawnCommand - #751
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #751 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 17 +1
Lines 440 445 +5
Branches 91 92 +1
=========================================
+ Hits 440 445 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2 of 3 tasks
2 of 3 tasks
On Windows, npx, pnpm, and yarn are .cmd shims that Node's spawn can't run without a shell, so formatters run through the package manager failed with `spawn npx ENOENT`. A new spawnCommand helper passes each command through tinyexec's normalizeSpawnCommand before node:child_process spawn, which wraps shims in an escaped cmd.exe call on Windows. dprint's editor-info probe now goes through spawnOutput rather than execFile, so it also gets this handling. Fixes #675 Co-Authored-By: Claude Opus 5.5 <[email protected]>
JoshuaKGoldberg
force-pushed
the
fix/windows-cross-spawn
branch
from
November 19, 2026 05:22
e38248e to
81cc323
Compare
JoshuaKGoldberg
marked this pull request as ready for review
November 19, 2026 05:24
|
🎉 This is included in version v0.12.1 🎉 The release is available on: Cheers! 📦🚀 |
JoshuaKGoldberg
added a commit
that referenced
this pull request
Nov 19, 2026
## PR Checklist - [x] Addresses an existing open issue: fixes #752 - [ ] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/formatly/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/formatly/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Runs the Test job on `macos-latest`, `ubuntu-latest`, and `windows-latest`, with `fail-fast: false` so one OS failing doesn't cancel the others. Only Ubuntu uploads coverage to Codecov. Test changes so the suite passes on every OS: - Unit tests for the `node_modules/.bin` fast path fake `process.platform` as `linux`, the same way an existing test already fakes `win32`. Previously their leftover `fs.access` mock also leaked into a later Deno test on Windows. - Unit tests that assert on spawned commands pass tinyexec's `normalizeSpawnCommand` through. On Windows it wraps `.cmd` shims and unresolved commands in `cmd.exe`. `spawnCommand.test.ts` still covers that wiring. - The e2e cleanup ignores `EBUSY` on Windows. dprint's long-lived editor service keeps its cwd busy there until the test process exits. The two Windows product bugs this CI originally caught were fixed in #751 (#675) and #755 (#754). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
PR Checklist
spawn npx ENOENT#675status: accepting prsOverview
On Windows,
resolvePackageCommandfalls back tonpx/pnpm/yarn, which are.cmdshims. Node'sspawncan't run those without a shell, so oxfmt, Biome, dprint, and out-of-cwd Prettier failed withspawn npx ENOENT.A new
spawnCommandhelper first runs each command through tinyexec'snormalizeSpawnCommand, then callsnode:child_process'sspawn. On Windows,normalizeSpawnCommandwraps shims in an escapedcmd.exe /d /s /ccall. On other platforms it returns its inputs unchanged. Every formatter spawn goes through the helper. dprint'seditor-infoprobe moved fromexecFileto the sharedspawnOutput, and it still falls back todprint fmt --stdinon any failure.tinyexec was chosen over cross-spawn because it has no dependencies, and e18e's module-replacements suggests it as cross-spawn's replacement. It's also already in most modern toolchains through vitest, tsup, and lint-staged. Using only its normalization, rather than its
x()runner, keeps the rawChildProcessthat the long-lived dprint editor service needs.Known limitations on Windows:
%VAR%in arguments passed through a.cmdshim..cmdfiles innode_modules/.bin, not fornpx.cmd. This only matters for arguments containing", which file paths can't contain. tinyexec has fixed it upstream (tinylibs/tinyexec#172), but the fix isn't released yet.ENOENTerror.--parent-pid.🤖 Generated with Claude Code