This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
//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)
|
||||
}
|
||||
Reference in New Issue
Block a user