File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1+ //go:build linux
2+ // +build linux
3+
4+ package main
5+
6+ import (
7+ "os/exec"
8+
9+ "golang.org/x/sys/unix"
10+ )
11+
12+ func SetSysProcAttr (cmd * exec.Cmd ) {
13+ cmd .SysProcAttr = & unix.SysProcAttr {
14+ Setpgid : true ,
15+ Pdeathsig : unix .SIGKILL ,
16+ }
17+ }
18+
19+ func KillCommand (cmd * exec.Cmd ) error {
20+ return unix .Kill (- cmd .Process .Pid , unix .SIGKILL )
21+ }
Original file line number Diff line number Diff line change 1- //go:build !windows
2- // +build !windows
1+ //go:build !windows && !linux
2+ // +build !windows,!linux
33
44package main
55
@@ -11,8 +11,7 @@ import (
1111
1212func SetSysProcAttr (cmd * exec.Cmd ) {
1313 cmd .SysProcAttr = & unix.SysProcAttr {
14- Setpgid : true ,
15- Pdeathsig : unix .SIGKILL ,
14+ Setpgid : true ,
1615 }
1716}
1817
You can’t perform that action at this time.
0 commit comments