mirror of https://github.com/docker/docs.git
Merge pull request #10882 from LK4D4/fix_possible_panic_on_kill
Fix possible panic on killing container
This commit is contained in:
commit
d125936015
|
@ -4,6 +4,7 @@ package native
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -173,6 +174,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driver) Kill(p *execdriver.Command, sig int) error {
|
func (d *driver) Kill(p *execdriver.Command, sig int) error {
|
||||||
|
if p.ProcessConfig.Process == nil {
|
||||||
|
return errors.New("exec: not started")
|
||||||
|
}
|
||||||
return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig))
|
return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue