Skip to content

scripts: win-shell-args mis-quotes an argument that ends in a backslash #5111

Closed

Description

@cliffhall

Problem

scripts/lib/win-shell-args.mjs quotes an argument for cmd.exe by wrapping it in "…" and doubling inner quotes. An argument that ends in a backslash (a directory path such as C:\Users\me\dir\) becomes "C:\Users\me\dir\", and the Windows C runtime's argument parser reads the final \" as an escaped quote, not the closing one, so the child receives a different argument (and the rest of the command line is swallowed into it). Backslashes immediately before an embedded quote have the same problem.

Dev tooling only: the callers are verify-skills-cli.mjs (the pinned validator, via npx) and claude-cli.mjs (skill evals) on Windows. Nothing published uses it. Found by Copilot on the v1.0.0 merge PR #5090.

Expected

Quoting follows the CRT rules: backslashes are doubled when they precede a " (including the closing one), with tests for a trailing backslash and for backslashes before an embedded quote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions