We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66b6d55 commit 3b9bd3aCopy full SHA for 3b9bd3a
1 file changed
pkg/proctree/proctree_freebsd.go
@@ -0,0 +1,25 @@
1
+//go:build freebsd
2
+
3
+package proctree
4
5
+import (
6
+ "syscall"
7
+)
8
9
+func startPlatform(p *ProcTree) error {
10
+ // Start the child in a new session (which also gives it a new process group
11
+ // with pgid == child's pid). That lets us signal the entire tree via -pid.
12
+ p.cmd.SysProcAttr = &syscall.SysProcAttr{
13
+ Setsid: true,
14
+ }
15
+ return p.cmd.Start()
16
+}
17
18
+func killPlatformTree(p *ProcTree) error {
19
+ if p.cmd.Process == nil {
20
+ return nil
21
22
+ // Signal the whole process group. Negative PID targets the PGID.
23
+ _ = syscall.Kill(-p.cmd.Process.Pid, syscall.SIGKILL)
24
+ return p.cmd.Process.Kill()
25
0 commit comments