Skip to content

Quote dash-prefixed path arguments in PowerShell wrapper#25

Open
caomengxuan666 wants to merge 1 commit into
microsoft:mainfrom
caomengxuan666:winuxcmd/quote-dash-paths
Open

Quote dash-prefixed path arguments in PowerShell wrapper#25
caomengxuan666 wants to merge 1 commit into
microsoft:mainfrom
caomengxuan666:winuxcmd/quote-dash-paths

Conversation

@caomengxuan666

Copy link
Copy Markdown
Contributor

Fixes one argument-passing edge case from #23.

In the PowerShell wrapper, bare arguments like -dash.txt are currently passed through unchanged. For .cmd targets running in Legacy native argument mode, PowerShell can split that token as -dash and .txt.

This change quotes extension-like dash-prefixed bare tokens before handing them to the .cmd entry point, while leaving ordinary bare globs unquoted so coreutils can still expand them.

Validated locally with the generated wrapper form:

cat -- '"-dash.txt"'
grep foo -- '"-dash.txt"'
cp -- '"-dash.txt"' dash-copy.txt

All three commands succeeded against a file named -dash.txt.

Comment thread src/pwsh-install-template.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants