Set parent death signal to all exec within the shim (#269)
This will prevent from leaving hung processes around if there's a bug in the runtime. Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
3c889979c9
commit
2d2dfab85a
1 changed files with 4 additions and 1 deletions
|
@ -222,6 +222,7 @@ func (p *process) start() error {
|
||||||
cmd.Stdin = p.stdio.stdin
|
cmd.Stdin = p.stdio.stdin
|
||||||
cmd.Stdout = p.stdio.stdout
|
cmd.Stdout = p.stdio.stdout
|
||||||
cmd.Stderr = p.stdio.stderr
|
cmd.Stderr = p.stdio.stderr
|
||||||
|
cmd.SysProcAttr = setPDeathSig()
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +232,9 @@ func (p *process) pid() int {
|
||||||
|
|
||||||
func (p *process) delete() error {
|
func (p *process) delete() error {
|
||||||
if !p.state.Exec {
|
if !p.state.Exec {
|
||||||
out, err := exec.Command(p.runtime, append(p.state.RuntimeArgs, "delete", p.id)...).CombinedOutput()
|
cmd := exec.Command(p.runtime, append(p.state.RuntimeArgs, "delete", p.id)...)
|
||||||
|
cmd.SysProcAttr = setPDeathSig()
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s: %v", out, err)
|
return fmt.Errorf("%s: %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue