Skip to content

Commit ee10230

Browse files
committed
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 docker-archive#457 Signed-off-by: Alexander Morozov <[email protected]>
1 parent dc4c502 commit ee10230

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

process_linux.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package libcontainer
44

55
import (
66
"encoding/json"
7+
"errors"
78
"io"
89
"os"
910
"os/exec"
@@ -44,8 +45,12 @@ func (p *setnsProcess) startTime() (string, error) {
4445
return system.GetProcessStartTime(p.pid())
4546
}
4647

47-
func (p *setnsProcess) signal(s os.Signal) error {
48-
return p.cmd.Process.Signal(s)
48+
func (p *setnsProcess) signal(sig os.Signal) error {
49+
s, ok := sig.(syscall.Signal)
50+
if !ok {
51+
return errors.New("os: unsupported signal type")
52+
}
53+
return syscall.Kill(p.cmd.Process.Pid, s)
4954
}
5055

5156
func (p *setnsProcess) start() (err error) {
@@ -235,6 +240,10 @@ func (p *initProcess) createNetworkInterfaces() error {
235240
return nil
236241
}
237242

238-
func (p *initProcess) signal(s os.Signal) error {
239-
return p.cmd.Process.Signal(s)
243+
func (p *initProcess) signal(sig os.Signal) error {
244+
s, ok := sig.(syscall.Signal)
245+
if !ok {
246+
return errors.New("os: unsupported signal type")
247+
}
248+
return syscall.Kill(p.cmd.Process.Pid, s)
240249
}

0 commit comments

Comments
 (0)