Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Blame · ci/agent/proctree_unix.go

Line attribution on main · 23 line(s)

215f8aeb
Keenan Nemetz
2d ago
1 //go:build unix
2
3 package agent
4
5 import (
6 "os/exec"
7 "syscall"
8 )
9
10 // newProcessGroup puts the command in its own process group, so a timeout or a
11 // stop request can signal the whole tree instead of only the process it started.
12 func newProcessGroup(cmd *exec.Cmd) {
13 cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
14 }
15
16 // killProcessGroup kills the group the command leads. A negative pid names the
17 // group, so a build step's own children go with it.
18 func killProcessGroup(cmd *exec.Cmd) error {
19 if cmd.Process == nil {
20 return nil
21 }
22 return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
23 }