Commit c8661106 authored by Tom Lanyon's avatar Tom Lanyon Committed by Rob Pike

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/79595Reviewed-by: default avatarRob Pike <r@golang.org>
parent e22d79ec
...@@ -77,9 +77,12 @@ type Cmd struct { ...@@ -77,9 +77,12 @@ type Cmd struct {
Dir string Dir string
// Stdin specifies the process's standard input. // Stdin specifies the process's standard input.
//
// If Stdin is nil, the process reads from the null device (os.DevNull). // If Stdin is nil, the process reads from the null device (os.DevNull).
//
// If Stdin is an *os.File, the process's standard input is connected // If Stdin is an *os.File, the process's standard input is connected
// directly to that file. // directly to that file.
//
// Otherwise, during the execution of the command a separate // Otherwise, during the execution of the command a separate
// goroutine reads from Stdin and delivers that data to the command // goroutine reads from Stdin and delivers that data to the command
// over a pipe. In this case, Wait does not complete until the goroutine // over a pipe. In this case, Wait does not complete until the goroutine
...@@ -92,14 +95,13 @@ type Cmd struct { ...@@ -92,14 +95,13 @@ type Cmd struct {
// If either is nil, Run connects the corresponding file descriptor // If either is nil, Run connects the corresponding file descriptor
// to the null device (os.DevNull). // to the null device (os.DevNull).
// //
// If either is an *os.File, the process's standard output or standard // If either is an *os.File, the corresponding output from the process
// error, respectively, are connected directly to that file. Otherwise, // is connected directly to that file.
// if either is not nil, during the execution of the command a separate //
// goroutine reads from the process's standard output or standard error // Otherwise, during the execution of the command a separate goroutine
// and delivers that to Stdout or Stderr. In this case, Wait does not // reads from the process over a pipe and delivers that data to the
// complete until the goroutine stops copying, either because it has // corresponding Writer. In this case, Wait does not complete until the
// reached the end of Stdin (EOF or a read error) or because writing to // goroutine reaches EOF or encounters an error.
// the pipe returned an error.
// //
// If Stdout and Stderr are the same writer, and have a type that can // If Stdout and Stderr are the same writer, and have a type that can
// be compared with ==, at most one goroutine at a time will call Write. // be compared with ==, at most one goroutine at a time will call Write.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment