mirror of
https://github.com/golang/go.git
synced 2026-04-03 17:59:55 +09:00
os/exec: document that Cmd.Wait must not be called concurrently
Clarify in the Wait documentation that it must not be called concurrently from multiple goroutines. Also note that a custom Cmd.Cancel function should not call Wait because Cancel may be invoked by watchCtx in a separate goroutine. Fixes #78046 Change-Id: I5c0ebc41bd3c39c78f3b37539c59cdfedfd90e72 Reviewed-on: https://go-review.googlesource.com/c/go/+/753602 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
8e1ecee491
commit
ff7ecb4efc
@@ -929,6 +929,9 @@ func (e *ExitError) Error() string {
|
||||
// If any of c.Stdin, c.Stdout or c.Stderr are not an [*os.File], Wait also waits
|
||||
// for the respective I/O loop copying to or from the process to complete.
|
||||
//
|
||||
// Wait must not be called concurrently from multiple goroutines.
|
||||
// A custom Cmd.Cancel function should not call Wait.
|
||||
//
|
||||
// Wait releases any resources associated with the [Cmd].
|
||||
func (c *Cmd) Wait() error {
|
||||
if c.Process == nil {
|
||||
|
||||
Reference in New Issue
Block a user