fix: quote SET dp0 in cmd shims to support paths with shell metacharacters - #189
Open
ashrafiucse wants to merge 1 commit into
Open
ashrafiucse wants to merge 1 commit into
ashrafiucse wants to merge 1 commit into
Conversation
This was referenced Sep 12, 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 #45
What
The
.cmdshims generated by cmd-shim set the batch file's directory with an unquotedSET:When the shim lives in a path containing cmd.exe metacharacters (e.g.
C:\test(n&pm)\or...\Playwright & API\...), the shell parses the&as a command separator. Two very confusing failures follow:'API\...\node_modules\.bin\' is not recognized as an internal or external command— cmd tries to execute the part of the path after the&Cannot find module 'C:\...\Playwright Learn\@playwright\test\cli.js'—dp0got truncated right before the&, so the target resolves against the wrong base directoryThis quotes the assignment using the standard safe idiom, which is already used for
_progin the same file:Notes
&,^,(and)in paths. A literal%in the path remains unfixable in batch syntax.dir & namefolder and executes it throughcmd.exe. Existing tests only snapshot the generated files, which is why a content-level regression like this could go unnoticed.