dev_unix.go

15 lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//go:build !windows

package commands

import "syscall"

// procesGroupAttr returns SysProcAttr that places the child in its own process group.
func processGroupAttr() *syscall.SysProcAttr {
	return &syscall.SysProcAttr{Setpgid: true}
}

// killProcessGroup sends a signal to the entire process group.
func killProcessGroup(pid int, sig syscall.Signal) {
	syscall.Kill(-pid, sig)
}