Skip to content

Commit 500562c

Browse files
Merge pull request #99 from go-cmd/dn/v1.4.2
Prepare v1.4.2: update docs, go.mod, some code comments
2 parents 745a5cf + ad53e14 commit 500562c

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## v1.4
44

5+
### v1.4.2 (2023-07-08)
6+
7+
* Added `Options.CombinedOutput` based on PR #76 by @jwomackgsa (issue #70)
8+
59
### v1.4.1 (2022-03-27)
610

711
* Added `Options.LineBufferSize` based on PR #85 by @Crevil (issue #66)

cmd.go

+11-13
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,17 @@ type Options struct {
147147
// See Cmd.Status for more info.
148148
Buffered bool
149149

150-
// If CombinedOutput is true, STDOUT and STDERR are written to Status.Stdout ONLY similar to 2>&1.
151-
// If CombinedOutput is used at the same time as Buffered, CombinedOutput will take preference.
152-
// Status.StdErr will be empty. The caller can call Cmd.Status to read output at intervals.
153-
// See Cmd.Status for more info.
150+
// If CombinedOutput is true, STDOUT and STDERR are written only to Status.Stdout
151+
// (similar to 2>&1 on Linux), and Status.StdErr will be empty. If CombinedOutput
152+
// is used Buffered, CombinedOutput takes preference. CombinedOutput does not work
153+
// with Streaming.
154154
CombinedOutput bool
155155

156156
// If Streaming is true, Cmd.Stdout and Cmd.Stderr channels are created and
157157
// STDOUT and STDERR output lines are written them in real time. This is
158158
// faster and more efficient than polling Cmd.Status. The caller must read both
159-
// streaming channels, else lines are dropped silently.
159+
// streaming channels, else lines are dropped silently. Streaming does not work
160+
// with CombinedOutput.
160161
Streaming bool
161162

162163
// BeforeExec is a list of functions called immediately before starting
@@ -166,8 +167,7 @@ type Options struct {
166167

167168
// LineBufferSize sets the size of the OutputStream line buffer. The default
168169
// value DEFAULT_LINE_BUFFER_SIZE is usually sufficient, but if
169-
// ErrLineBufferOverflow errors occur, try increasing the size with this
170-
// field.
170+
// ErrLineBufferOverflow errors occur, try increasing the size with this field.
171171
LineBufferSize uint
172172
}
173173

@@ -227,10 +227,9 @@ func NewCmdOptions(options Options, name string, args ...string) *Cmd {
227227
return c
228228
}
229229

230-
// Clone clones a Cmd. All the options are transferred,
231-
// but the internal state of the original object is lost.
232-
// Cmd is one-use only, so if you need to re-start a Cmd,
233-
// you need to Clone it.
230+
// Clone clones a Cmd. All the options are transferred, but the internal state
231+
// of the original object is lost. Cmd is one-use only, so if you need to restart
232+
// a Cmd, you need to Clone it.
234233
func (c *Cmd) Clone() *Cmd {
235234
clone := NewCmdOptions(
236235
Options{
@@ -340,8 +339,7 @@ func (c *Cmd) Stop() error {
340339
// consider using streaming output. When the command finishes, buffered output
341340
// is complete and final.
342341
//
343-
// Status.Runtime is updated while the command is running and final when it
344-
// finishes.
342+
// Status.Runtime is updated while the command runs and is final when it finishes.
345343
func (c *Cmd) Status() Status {
346344
c.Lock()
347345
defer c.Unlock()

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/go-cmd/cmd
22

3-
go 1.17
3+
go 1.20
44

5-
require github.com/go-test/deep v1.0.7
5+
require github.com/go-test/deep v1.1.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
2-
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
1+
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
2+
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=

0 commit comments

Comments
 (0)