Commit 07e2b404 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

os: don't allow Process.Kill after Process.Release

This is a user error, but killing -1 kills everything, which
is a pretty bad failure mode.

Fixes #7434

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/70140043
parent 916682ea
...@@ -38,6 +38,9 @@ func (p *Process) signal(sig Signal) error { ...@@ -38,6 +38,9 @@ func (p *Process) signal(sig Signal) error {
if p.done() { if p.done() {
return errors.New("os: process already finished") return errors.New("os: process already finished")
} }
if p.Pid == -1 {
return errors.New("os: process already released")
}
s, ok := sig.(syscall.Signal) s, ok := sig.(syscall.Signal)
if !ok { if !ok {
return errors.New("os: unsupported signal type") return errors.New("os: unsupported signal type")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment