configui/muzanctl.go

25 lines
408 B
Go

//go:build !windows
// +build !windows
package configui
import (
"os/exec"
"syscall"
)
func setgpid(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
func (oni *Oni) Kill() error {
if oni.cmd == nil {
return nil
}
pgid, err := syscall.Getpgid(oni.cmd.Process.Pid)
if err == nil {
return syscall.Kill(-pgid, 15) // note the minus sign
}
return oni.cmd.Process.Kill()
}