-
Notifications
You must be signed in to change notification settings - Fork 294
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
pkg/tool/exec: Fix parsing cmd string args #3207
Conversation
7372cfa
to
7d11a03
Compare
Signed-off-by: infogulch <[email protected]>
Signed-off-by: infogulch <[email protected]>
Signed-off-by: infogulch <[email protected]>
Hi, thanks for sending a pull request! I'm sure you have seen, but much like Go's I hope that makes sense. I would advocate for deprecating the string form of the command because perhaps it's a footgun that it uses https://pkg.go.dev/strings#Fields - it is rather basic. And perhaps some users would expect that it would use shell syntax, and we don't want to give that impression. |
Yes I ran into this issue trying to pass a string cmd like I looked and noticed that it would be low effort to integrate this small library to go from poor to very good arg parsing support, so I opened this PR to kick off a discussion with a concrete implementation in hand to refer to. I would not be too sad if the decision was no. Consider:
Of course adding a new dependency is something cue maintainers would want to consider carefully. Given its small size (~300loc), maybe "vendoring" / copying the code into the repo would be better if we want to avoid an explicit dependency? |
It just occurred to me that arg splitting / joining could be useful functionality to cue scripts in general. What if we added |
Closing for now, as I explained in #3238 (comment). Thanks for contributing! |
This PR fixes broken string arg parsing in pkg/tool/exec, using the
github.com/kballard/go-shellquote
library.