Skip to content

Commit c866110

Browse files
tomlanyonrobpike
authored andcommitted
os/exec: Stdout/Stderr doc cleanup.
Following comments on CL 76320. Breaks Cmd.Std{out,err} doc into three paragraphs and updates Cmd.Stdin formatting to match. Fixes an erroneous reference to Stdin in the output goroutine comment, while keeping the wording consistent between Stdin and Stdout/Stderr. Change-Id: I186a0e2d4b85dfb939443a17e62a1eb2ef64b1bf Reviewed-on: https://go-review.googlesource.com/79595 Reviewed-by: Rob Pike <[email protected]>
1 parent e22d79e commit c866110

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/os/exec/exec.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ type Cmd struct {
7777
Dir string
7878

7979
// Stdin specifies the process's standard input.
80+
//
8081
// If Stdin is nil, the process reads from the null device (os.DevNull).
82+
//
8183
// If Stdin is an *os.File, the process's standard input is connected
8284
// directly to that file.
85+
//
8386
// Otherwise, during the execution of the command a separate
8487
// goroutine reads from Stdin and delivers that data to the command
8588
// over a pipe. In this case, Wait does not complete until the goroutine
@@ -92,14 +95,13 @@ type Cmd struct {
9295
// If either is nil, Run connects the corresponding file descriptor
9396
// to the null device (os.DevNull).
9497
//
95-
// If either is an *os.File, the process's standard output or standard
96-
// error, respectively, are connected directly to that file. Otherwise,
97-
// if either is not nil, during the execution of the command a separate
98-
// goroutine reads from the process's standard output or standard error
99-
// and delivers that to Stdout or Stderr. In this case, Wait does not
100-
// complete until the goroutine stops copying, either because it has
101-
// reached the end of Stdin (EOF or a read error) or because writing to
102-
// the pipe returned an error.
98+
// If either is an *os.File, the corresponding output from the process
99+
// is connected directly to that file.
100+
//
101+
// Otherwise, during the execution of the command a separate goroutine
102+
// reads from the process over a pipe and delivers that data to the
103+
// corresponding Writer. In this case, Wait does not complete until the
104+
// goroutine reaches EOF or encounters an error.
103105
//
104106
// If Stdout and Stderr are the same writer, and have a type that can
105107
// be compared with ==, at most one goroutine at a time will call Write.

0 commit comments

Comments
 (0)