2020-10-10 09:41:20 +00:00
|
|
|
package internal
|
2020-09-10 10:11:34 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
func SetBinFlags(cmd *exec.Cmd) {
|
|
|
|
if cmd.SysProcAttr == nil {
|
|
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
|
|
}
|
|
|
|
cmd.SysProcAttr.Pdeathsig = syscall.SIGTERM
|
|
|
|
cmd.SysProcAttr.Setpgid = true
|
|
|
|
}
|
2020-10-10 09:41:20 +00:00
|
|
|
|
|
|
|
func IntSignal(cmd *exec.Cmd) error {
|
|
|
|
return syscall.Kill(-cmd.Process.Pid, syscall.SIGINT)
|
|
|
|
}
|
|
|
|
|
|
|
|
func KillSignal(cmd *exec.Cmd) error {
|
|
|
|
return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
|
|
|
|
}
|