-
Notifications
You must be signed in to change notification settings - Fork 516
Fix stdio client transport CLI argument escaping. #811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix stdio client transport CLI argument escaping. #811
Conversation
cc @jozkee |
string id = Guid.NewGuid().ToString("N"); | ||
|
||
StdioClientTransport transport = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? | ||
new(new() { Command = "cmd", Arguments = ["/C", $"echo \"{id}\" >&2"] }, LoggerFactory) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PederHP @jeffhandley A side effect of this change is that inserting shell pipe syntax in the CLI arguments is no longer possible. I think this is ok given it's a Windows-specific quirk, but I thought I'd double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some ideas, we could:
- Not change the behavior and defer to users the escaping of characters like &, we could also augment the remarks around
StdioClientTransportOptions.Arguments
. - Use Arguments instead of ArgumentList, but that requires implementing our own escaping, basically a copy of PasteArguments that wraps the argument in quotes if it contains &.
9d3db19
to
7505d2a
Compare
Fix #594.