Skip to content

Commit bdcfba4

Browse files
committed
Fix macos build issue
1 parent e1a0145 commit bdcfba4

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

backend/worker_linux.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}

backend/worker_unix.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !windows
2-
// +build !windows
1+
//go:build !windows && !linux
2+
// +build !windows,!linux
33

44
package main
55

@@ -11,8 +11,7 @@ import (
1111

1212
func SetSysProcAttr(cmd *exec.Cmd) {
1313
cmd.SysProcAttr = &unix.SysProcAttr{
14-
Setpgid: true,
15-
Pdeathsig: unix.SIGKILL,
14+
Setpgid: true,
1615
}
1716
}
1817

0 commit comments

Comments
 (0)