Use syscall.Kill instead of p.cmd.Process.Kill

We need this to unmask syscall.ESRCH error, which handled in docker and
can be handled by other clients.

Closes #457

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-03-27 10:50:32 -07:00
parent dc4c502efd
commit ee102305fb
1 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@ package libcontainer
import (
"encoding/json"
"errors"
"io"
"os"
"os/exec"
@ -44,8 +45,12 @@ func (p *setnsProcess) startTime() (string, error) {
return system.GetProcessStartTime(p.pid())
}
func (p *setnsProcess) signal(s os.Signal) error {
return p.cmd.Process.Signal(s)
func (p *setnsProcess) signal(sig os.Signal) error {
s, ok := sig.(syscall.Signal)
if !ok {
return errors.New("os: unsupported signal type")
}
return syscall.Kill(p.cmd.Process.Pid, s)
}
func (p *setnsProcess) start() (err error) {
@ -235,6 +240,10 @@ func (p *initProcess) createNetworkInterfaces() error {
return nil
}
func (p *initProcess) signal(s os.Signal) error {
return p.cmd.Process.Signal(s)
func (p *initProcess) signal(sig os.Signal) error {
s, ok := sig.(syscall.Signal)
if !ok {
return errors.New("os: unsupported signal type")
}
return syscall.Kill(p.cmd.Process.Pid, s)
}