Skip to content
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

Is there a way to have stderr buffered into stdout #70

Closed
jwomackgsa opened this issue Oct 6, 2021 · 3 comments
Closed

Is there a way to have stderr buffered into stdout #70

jwomackgsa opened this issue Oct 6, 2021 · 3 comments

Comments

@jwomackgsa
Copy link
Contributor

I know the standard os/exec lib has a function called CombinedOutput. Can go-cmd do something similar? My use case is after an executable has run, I am writing the stdout / stderr buffers to a log file. If the executable's output produces both stdout and stderr output, I don't have a way to produce a consolidated log in the order the output was received. I know this can be handled by streaming and the select, but was wanting to use the buffer since I don't have a need for real time inspection.

@jwomackgsa
Copy link
Contributor Author

I have taken an initial pass at adding this functionality. Here is the branch from my fork. All tests are passing including the additional one I added cloned from the bothOutput Test and make applicate changes.

https://github.com/jwomackgsa/cmd/tree/add-buffered-combinedoutput

@daniel-nichter
Copy link
Member

#76

@daniel-nichter
Copy link
Member

Thank you for the contribution, @jwomackgsa. Merged, and will be in release as v1.4.2.

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

No branches or pull requests

2 participants