diff options
| author | Colin Arnott <colin@urandom.co.uk> | 2020-07-16 17:42:47 +0000 |
|---|---|---|
| committer | Tobias Klauser <tobias.klauser@gmail.com> | 2020-10-31 08:41:25 +0000 |
| commit | f14119b561cfeefb93e8d773033caeea572dbe71 (patch) | |
| tree | 4385dac30bb4ca224a534118731e121491b9df19 /src/os/exec_unix.go | |
| parent | 12a2e72065105a7c167d7f41500b5a80547f14d0 (diff) | |
| download | go-f14119b561cfeefb93e8d773033caeea572dbe71.tar.xz | |
os: export errFinished as ErrProcessDone
(*Process).Signal returns an error sentinel, previously errFinished,
when (*Process).done or syscall.ESRCH. Callers would like the ability to
test for this state, so the value has been exported as ErrProcessDone.
Fixes #39444
Change-Id: I510e7647cc032af290180de5149f35ab7b09a526
Reviewed-on: https://go-review.googlesource.com/c/go/+/242998
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/os/exec_unix.go')
| -rw-r--r-- | src/os/exec_unix.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/os/exec_unix.go b/src/os/exec_unix.go index 7759a2d2ea..624061297b 100644 --- a/src/os/exec_unix.go +++ b/src/os/exec_unix.go @@ -59,7 +59,8 @@ func (p *Process) wait() (ps *ProcessState, err error) { return ps, nil } -var errFinished = errors.New("os: process already finished") +// ErrProcessDone indicates a Process has finished. +var ErrProcessDone = errors.New("os: process already finished") func (p *Process) signal(sig Signal) error { if p.Pid == -1 { @@ -71,7 +72,7 @@ func (p *Process) signal(sig Signal) error { p.sigMu.RLock() defer p.sigMu.RUnlock() if p.done() { - return errFinished + return ErrProcessDone } s, ok := sig.(syscall.Signal) if !ok { @@ -79,7 +80,7 @@ func (p *Process) signal(sig Signal) error { } if e := syscall.Kill(p.Pid, s); e != nil { if e == syscall.ESRCH { - return errFinished + return ErrProcessDone } return e } |
