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.
|
215f8aeb
Keenan Nemetz
2d ago
|
1 | //go:build unix |
| 2 | ||
| 3 | package server_test | |
| 4 | ||
| 5 | import ( | |
| 6 | "os/exec" | |
| 7 | "syscall" | |
| 8 | ) | |
| 9 | ||
| 10 | // ownProcessGroup puts the runner under test in its own process group, so the | |
| 11 | // cleanup below can kill the runner and everything it started. Without it, a | |
| 12 | // killed test leaves containers or build steps behind. | |
| 13 | func ownProcessGroup(cmd *exec.Cmd) { | |
| 14 | cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} | |
| 15 | } | |
| 16 | ||
| 17 | // killRunnerTree kills the runner's process group. A negative pid names the | |
| 18 | // group; the process is then reaped by the caller's Wait. | |
| 19 | func killRunnerTree(cmd *exec.Cmd) error { | |
| 20 | if cmd.Process == nil { | |
| 21 | return nil | |
| 22 | } | |
| 23 | return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) | |
| 24 | } |