]> Cypherpunks repositories - gostls13.git/commit
os/exec: add closeOnce.WriteString method
authorIan Lance Taylor <iant@golang.org>
Wed, 16 Nov 2016 01:55:28 +0000 (17:55 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 16 Nov 2016 02:24:30 +0000 (02:24 +0000)
commitb906df653b58bc2ab9b93e18f62adccc8c1419b7
treefa1a7a507fcaea633dc0c66348ea3fe0df942613
parent1b66b38e25af567aa30a7b22581c05285be3564a
os/exec: add closeOnce.WriteString method

Add an explicit WriteString method to closeOnce that acquires the
writers lock.  This overrides the one promoted from the
embedded *os.File field.  The promoted one naturally does not acquire
the lock, and can therefore race with the Close method.

Fixes #17647.

Change-Id: I3460f2a0d503449481cfb2fd4628b4855ab0ecdf
Reviewed-on: https://go-review.googlesource.com/33298
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/dist/test.go
src/os/exec/exec.go
src/os/exec/exec_test.go