You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
479 B
Go
26 lines
479 B
Go
//go:build darwin
|
|
|
|
package worker
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
func configureProcess(command *exec.Cmd) {
|
|
command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
|
}
|
|
|
|
func terminateProcessGroup(command *exec.Cmd) {
|
|
if command.Process != nil {
|
|
_ = syscall.Kill(-command.Process.Pid, syscall.SIGTERM)
|
|
}
|
|
}
|
|
|
|
func killProcessGroup(command *exec.Cmd) {
|
|
if command.Process != nil {
|
|
_ = syscall.Kill(-command.Process.Pid, syscall.SIGKILL)
|
|
_ = command.Process.Kill()
|
|
}
|
|
}
|