add pdeathsig

This commit is contained in:
Boshi Lian 2022-07-06 00:14:10 +00:00
parent b45652b305
commit 0ebe1e19d5
3 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,8 @@
//go:build !linux
package main
import "os/exec"
func setPdeathsig(cmd *exec.Cmd) {
}

View file

@ -0,0 +1,12 @@
//go:build linux
package main
import (
"os/exec"
"syscall"
)
func setPdeathsig(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGTERM}
}

View file

@ -59,6 +59,7 @@ func createPlugin(args []string) (*plugin.GrpcPlugin, error) {
default:
cmd := exec.Command(exe)
cmd.Args = args
setPdeathsig(cmd)
log.Info("starting child process plugin: ", cmd.Args)