cmd icon indicating copy to clipboard operation
cmd copied to clipboard

Is there a way to have stderr buffered into stdout

Open jwomackgsa opened this issue 4 years ago • 1 comments

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 avatar Oct 06 '21 16:10 jwomackgsa

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

jwomackgsa avatar Oct 06 '21 21:10 jwomackgsa

#76

daniel-nichter avatar Jul 06 '23 17:07 daniel-nichter

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

daniel-nichter avatar Jul 08 '23 19:07 daniel-nichter