| 1 | // Copyright 2025 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build unix |
| 6 | |
| 7 | package debug |
| 8 | |
| 9 | import ( |
| 10 | "os" |
| 11 | "syscall" |
| 12 | ) |
| 13 | |
| 14 | func init() { |
| 15 | // UNIX: kill the whole process group, since |
| 16 | // "go tool trace" starts a cmd/trace child. |
| 17 | kill = killGroup |
| 18 | sysProcAttr.Setpgid = true |
| 19 | } |
| 20 | |
| 21 | func killGroup(p *os.Process) error { |
| 22 | return syscall.Kill(-p.Pid, syscall.SIGKILL) |
| 23 | } |