summaryrefslogtreecommitdiff
path: root/libgo/go/os/exec_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/exec_unix.go')
-rw-r--r--libgo/go/os/exec_unix.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/libgo/go/os/exec_unix.go b/libgo/go/os/exec_unix.go
index 1b1e3350b84..ed97f85e22f 100644
--- a/libgo/go/os/exec_unix.go
+++ b/libgo/go/os/exec_unix.go
@@ -34,18 +34,26 @@ func (p *Process) wait() (ps *ProcessState, err error) {
return ps, nil
}
+var errFinished = errors.New("os: process already finished")
+
func (p *Process) signal(sig Signal) error {
- if p.done() {
- return errors.New("os: process already finished")
- }
if p.Pid == -1 {
return errors.New("os: process already released")
}
+ if p.Pid == 0 {
+ return errors.New("os: process not initialized")
+ }
+ if p.done() {
+ return errFinished
+ }
s, ok := sig.(syscall.Signal)
if !ok {
return errors.New("os: unsupported signal type")
}
if e := syscall.Kill(p.Pid, s); e != nil {
+ if e == syscall.ESRCH {
+ return errFinished
+ }
return e
}
return nil