Files
syncbot/internal/gitx/proc_unix.go
T
iceBear67 a006483bbc
ci / test (push) Canceled after 0s
docker / build (push) Canceled after 0s
init
2026-08-14 07:13:22 +00:00

25 lines
521 B
Go

//go:build unix
package gitx
import (
"syscall"
"time"
)
// sysProcAttr puts git in its own process group so we can signal the whole
// tree — git itself plus the ssh or git-remote-https helper it spawned.
func sysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{Setpgid: true}
}
// terminate asks the process group to exit, then insists.
func terminate(pid int) {
if pid <= 0 {
return
}
_ = syscall.Kill(-pid, syscall.SIGTERM)
time.Sleep(termGrace)
_ = syscall.Kill(-pid, syscall.SIGKILL)
}