Repository navigation
Add ConvertTo-PkArgumentString for quoting program arguments - #8
Merged
Merged
Conversation
.NET Framework's ProcessStartInfo has no ArgumentList, so every caller hand-quoted paths into one Arguments string, which breaks on embedded quotes and trailing backslashes. ConvertTo-PkArgumentString joins a list of arguments using the C runtime's quoting rules. It's available inside workers too. README examples use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The round-trip test ignored csc.exe's result, so a failed compile ended the harness with a 'could not start' error instead of a [FAIL] line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong. .NET Framework's
ProcessStartInfohas noArgumentList, so every command'sArgumentswas hand-built, like the README's'"{0}" "{0}.jxl"' -f $path. That breaks on a path with a quote in it or a trailing backslash ("C:\dir\"escapes its own closing quote).What changed. New
ConvertTo-PkArgumentString @($a, $b, ...)joins arguments into one command line using the C runtime's rules, which most Windows programs follow:"".It's in the worker-safe list, so workers have it too. The README's examples use it, and the function table lists it.
Testing. Exact-output assertions for the tricky cases, plus a round trip: the harness compiles a tiny program with
csc.exethat prints each argument it receives, and checks it gets back exactly the list given (spaces, empty, quotes,a\"b, a tab,x\y, trailing backslashes, a UNC path). 184 assertions pass on 5.1. The round trip also passes under PowerShell 7; that full run otherwise needs #6's harness fix.🤖 Generated with Claude Code