Conversation
shellQuote used single quotes, which cmd.exe does not understand. A test name with spaces split into several arguments, and a jest, vitest, mocha, minitest or rails-test run with two or more tests put a | in the name filter, which cmd.exe read as a pipe. On Windows the argument is now double-quoted for the program and every character cmd.exe acts on, the quotes included, is escaped with ^, so cmd.exe passes the string through untouched (the cross-spawn scheme). A bare % is not left unquoted there, since it can name a variable. A test runs every quoted argument through the real shell and checks that it reaches the program as written; the Windows CI runner runs it through cmd.exe. Closes #7 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dividedmind
approved these changes
Sep 28, 2026
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.
Fixes #7.
shellQuotequoted arguments with single quotes, whichcmd.exedoes not understand. On Windows a test name with spaces split into several arguments, and a jest, vitest, mocha, minitest or rails-test run with two or more tests put a|in the name filter, whichcmd.exeread as a pipe.How it quotes now on Windows
cmd.exegets the whole command line as one string, and the program splits it itself using C runtime rules (double quotes group,\"is a literal quote). So the argument is wrapped in double quotes for the program, and every charactercmd.exeacts on, the quotes included, is escaped with^.cmd.exethen never enters quote mode and hands the string over untouched. This is the scheme cross-spawn uses.tests/test_a.py::test_xcreates an order'creates an order'^"creates an order^"(adds|removes)'(adds|removes)'^"^(adds^|removes^)^"100%^"100^%^"(a bare%can name a variable tocmd.exe)Nothing changes on macOS or Linux.
shellQuotetakes aplatform(defaultprocess.platform), andbuildCommandpasses it through, so the Windows cases are tested on any machine.Evidence
One test writes a Node script that prints its argv, runs it through the real shell with every kind of argument (spaces, a regex union, escaped parentheses, quotes,
& < > ^,%, a trailing backslash), and checks that each one arrives as written. On the Windows runner that shell iscmd.exe.🤖 Generated with Claude Code