]> Cypherpunks repositories - gostls13.git/commit
os/exec: allow simultaneous cmd.Wait and Write of cmd.StdinPipe
authorRuss Cox <rsc@golang.org>
Mon, 17 Oct 2016 21:20:48 +0000 (17:20 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 18 Oct 2016 12:48:03 +0000 (12:48 +0000)
commit736443c13a718f0a9c30327ebbf09f58ccbe6d49
treeb2db1437924ec42c30a14122087ffbb353f503b7
parent5fbf35dc3fadd29785739fcec061d42157ea7861
os/exec: allow simultaneous cmd.Wait and Write of cmd.StdinPipe

cmd.StdinPipe returns an io.WriteCloser.
It's reasonable to expect the caller not to call Write and Close simultaneously,
but there is an implicit Close in cmd.Wait that's not obvious.
We already synchronize the implicit Close in cmd.Wait against
any explicit Close from the caller. Also synchronize that implicit
Close against any explicit Write from the caller.

Fixes #9307.

Change-Id: I8561e9369d6e5ac88dfbca1175549f6dfa04b8ac
Reviewed-on: https://go-review.googlesource.com/31148
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/exec/exec.go
src/os/exec/exec_test.go