mirror of https://github.com/golang/go.git
os: export ErrProcessDone variable in windows and plan9
Exposes ErrProcessDone variable in windows and plan9
also returns this error code instead of
errors.New("os: process already finished")
Fixes #42311
Change-Id: Ie807b6526e7b6c27636e6bffe5ff0c904b319be4
GitHub-Last-Rev: 2153e0d702
GitHub-Pull-Request: golang/go#42313
Reviewed-on: https://go-review.googlesource.com/c/go/+/266997
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
ebc1b8ef28
commit
45205bc47b
|
|
@ -5,6 +5,7 @@
|
|||
package os
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"internal/testlog"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
|
@ -13,6 +14,9 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
// ErrProcessDone indicates a Process has finished.
|
||||
var ErrProcessDone = errors.New("os: process already finished")
|
||||
|
||||
// Process stores the information about a process created by StartProcess.
|
||||
type Process struct {
|
||||
Pid int
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
package os
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
|
@ -52,7 +51,7 @@ func (p *Process) writeProcFile(file string, data string) error {
|
|||
|
||||
func (p *Process) signal(sig Signal) error {
|
||||
if p.done() {
|
||||
return errors.New("os: process already finished")
|
||||
return ErrProcessDone
|
||||
}
|
||||
if e := p.writeProcFile("note", sig.String()); e != nil {
|
||||
return NewSyscallError("signal", e)
|
||||
|
|
|
|||
|
|
@ -59,9 +59,6 @@ func (p *Process) wait() (ps *ProcessState, err error) {
|
|||
return ps, nil
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return errors.New("os: process already released")
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func (p *Process) signal(sig Signal) error {
|
|||
return syscall.EINVAL
|
||||
}
|
||||
if p.done() {
|
||||
return errors.New("os: process already finished")
|
||||
return ErrProcessDone
|
||||
}
|
||||
if sig == Kill {
|
||||
err := terminateProcess(p.Pid, 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue