]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: document that non-comparable writers may race
authorJustin Nuß <nuss.justin@gmail.com>
Fri, 28 Apr 2017 10:04:45 +0000 (12:04 +0200)
committerIan Lance Taylor <iant@golang.org>
Fri, 28 Apr 2017 17:57:01 +0000 (17:57 +0000)
The comment for Cmd.Stdout and Cmd.Stderr says that it's safe to
set both to the same writer, but it doesn't say that this only
works when both writers are comparable.

This change updates the comment to explain that using a
non-comparable writer may still lead to a race.

Fixes #19804

Change-Id: I63b420034666209a2b6fab48b9047c9d07b825e2
Reviewed-on: https://go-review.googlesource.com/42052
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/exec/exec.go

index 6b5d70990a37317a4674aa5c7bd50feb7c1db399..0b16f22a99f8e6be431d735ac28c9d63749c7ed9 100644 (file)
@@ -83,8 +83,8 @@ type Cmd struct {
        // If either is nil, Run connects the corresponding file descriptor
        // to the null device (os.DevNull).
        //
-       // If Stdout and Stderr are the same writer, at most one
-       // goroutine at a time will call Write.
+       // 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.
        Stdout io.Writer
        Stderr io.Writer