-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: os/exec: add method Cmd.String #30638
Comments
I've implemented this a couple of times myself, so I'd like to see it in os/exec too. |
As a bonus we could shell-quote args as needed for clarity. But too far down that path lies madness. The intent is human readable output only. We’d document that. |
I've often wanted this as well. But I've also often extended such a string to be prefixed by the environment variables I added atop
This is clearly not an argument against |
@myitcv I have done that in the past, in places where I knew |
Totally. Just to confirm, I was not advocating broadening the scope, just raising the question. |
ISTM that this is still useful: you’d print the appropriate env vars and then use String to print the rest. But perhaps I misunderstand the question. |
Accepted per @golang/proposal-review . |
Change https://golang.org/cl/168518 mentions this issue: |
It is common to want to log a command that you are about to run (or a command that you just ran, on error). Currently to do that you have to combine Cmd.Path and strings.Join Cmd.Args. I propose that we add a String method to Cmd that implements this very common need.
The text was updated successfully, but these errors were encountered: