commit | 9a029a69157788d072147732fe2665c58bbbc02c | [log] [tgz] |
---|---|---|
author | Bryan C. Mills <bcmills@google.com> | Fri Sep 30 11:08:54 2022 -0400 |
committer | Gopher Robot <gobot@golang.org> | Sat Oct 01 00:21:25 2022 +0000 |
tree | e42d3c44a35eb6dd3342b5e94a9de1c9cd98d89c | |
parent | c9a62b7e711f5c1f1a73e0c3a5b6a2e5b67033e2 [diff] |
os/exec: make StdoutPipe and StderrPipe safe to Close concurrently For #50436, I want to be able to close the pipes returned by StdoutPipe and StderrPipe after the Context has been canceled and the WaitDelay has subsequently expired. However, the fact that the exec.onceCloser wrapper for StdinPipe (added in CL 13329043) was retained in CL 65490 suggests to me that (*os.File).Close is still not safe to call concurrently. This may cause type assertions of these ReadClosers to *os.File that once succeeded to no longer do so. However, the StdoutPipe and StderrPipe methods return interfaces, not concrete *os.Files, so callers already should not have been relying on that implementation detail — and as far as I can tell the closeOnce wrapper does not mask any (*os.File) methods, so assertions to any interface type that previously succeeded will continue to do so. This change is logically part of CL 401835, but since it may expose fragile type-assertions in callers I want to keep it separate for clearer bisection of any new test failures. For #50436. Change-Id: I58de1d48fb6fd788502f13657d8d4484516271cf Reviewed-on: https://go-review.googlesource.com/c/go/+/437176 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.