testcontainers-go
testcontainers-go copied to clipboard
Add function to exec and get output
It would be nice to have a function called ExecOutput
that would let the user see the output of an exec command. I've got this fully written with testing; I just want to make sure that this is a welcome addition first :)
I have it already implemented here: #97
Where is it implemented? I don't see anything about execing in a specific container.
Sorry, typing on mobile... It is a function to retrieve the output of an exec in a container to get the environment variables.
Ah I see. I still think that a command that did the exec with the Docker api like the current exec command but also returned the output from the command would be useful as well. The method I have is of the signature:
func (c *DockerContainer) ExecOut(ctx context.Context, cmd []string) (int, string, error) {
I'd rather using your function, so I'd rebase my PR and use yours instead
Awesome. Let me polish it off, and I'll PR.
Thanks for doing it! Should we use an io.Reader as return type?!
Yup I'm open to using an io.Reader
as the return type. If we're using a reader, do we still want to wait to return until the exec is done, or do we want to allow the user to read off the reader while the command is executing?
I prefer to have the user reading the io.Reader, it looks more flexible to me
On Wed, Jan 8, 2020 at 4:07 PM Peyton Walters [email protected] wrote:
Yup I'm open to using an io.Reader as the return type. If we're using a reader, do we still want to wait to return until the exec is done, or do we want to allow the user to read off the reader while the command is executing?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/testcontainers/testcontainers-go/issues/126?email_source=notifications&email_token=AAMOAO3TW2HZL7YBBTIAAWTQ4XT4VA5CNFSM4KCXDE42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIM3VUI#issuecomment-572111569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOAO77GFYR3ZLKYPCF5MLQ4XT4VANCNFSM4KCXDE4Q .
-- Gianluca Arbezzano www.gianarb.it
Hey, whats the status of this? Getting the result of the command would be very useful to me, kinda stuck right now with this...
This is a legit and Executing a command is what we should implement in Go.
Hello, Do we have any updates on this? Would like to use this functionality or contribute towards making it work. Thanks!
This would be very nice
I think we can close this issue, as it was implemented in #435 and released in v0.14.0
: it returns the output reader instead of its string representation, so the consumers will handle it in whatever manner they want.
Please consider that it represents a breaking change
Thanks everybody here for your support!