cmd icon indicating copy to clipboard operation
cmd copied to clipboard

Add buffered combinedoutput

Open jwomackgsa opened this issue 3 years ago • 1 comments

Additional feature that allows the buffered output to have stdout and stderr combined into the same buffer which provides a capability to easily dump the buffered output to a log file.

jwomackgsa avatar Nov 18 '21 23:11 jwomackgsa

I am still interested in this being added into the project. I brought my fork into sync with the recent updates and should merge cleanly if accepted. I welcome any comments.

jwomackgsa avatar Apr 21 '22 15:04 jwomackgsa

I would like this to be merged too... If that helps :)

ip-rw avatar Dec 03 '22 16:12 ip-rw

+1 respect, useful feature

MXWXZ avatar Jul 06 '23 06:07 MXWXZ

Sorry for long delay. Free open source software moves very slowly at times.

The feature idea is good, but let's fix two things:

  1. s/BufferedCombined/CombinedOutput/ for two reasons. It mirrors Go os.Exec, and later we should extend the functionality to streaming output, too. For now, we can document that Option.CombinedOutput only works for buffered.
  2. Test coverage is missing on,
        case c.stdoutBuf != nil && c.stderrBuf == nil: // buffer combining stderr into stdout
                cmd.Stdout = c.stdoutBuf
                cmd.Stderr = c.stdoutBuf

I'm not sure why because you've got a test case, but it seems the test case doesn't actually hit that code.

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

Great to see some movement on this PR. I will work on making some updates on the naming and the test cases and report back for another review.

jwomackgsa avatar Jul 06 '23 17:07 jwomackgsa

I have updated my branch with the option name update and the additional coverage test. Coverage is now reporting 100%. Please let me know if anything further is needed to merge this feature.

jwomackgsa avatar Jul 07 '23 20:07 jwomackgsa

Ack, thanks @jwomackgsa. I'll take a look this weekend.

daniel-nichter avatar Jul 07 '23 21:07 daniel-nichter