diff options
| author | Basavaraj PB <basavarajbankolli76@gmail.com> | 2026-03-10 23:28:14 +0530 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-17 11:58:30 -0700 |
| commit | ff7ecb4efc2f754709ec018ae822fb411fcfa5a9 (patch) | |
| tree | 04b44b849a57d75c726c3d33996ceaef4784370e /src/os/exec | |
| parent | 8e1ecee49120359594cad3b3e6e6464eb3945f49 (diff) | |
| download | go-ff7ecb4efc2f754709ec018ae822fb411fcfa5a9.tar.xz | |
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>
Diffstat (limited to 'src/os/exec')
| -rw-r--r-- | src/os/exec/exec.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go index e5bf97a188..26ddfe633c 100644 --- a/src/os/exec/exec.go +++ b/src/os/exec/exec.go @@ -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 { |
