fix: add platform-specific sysproc for Windows and macOS

This commit is contained in:
jegly 2026-03-27 14:05:18 +11:00
commit 7f145b350e
3 changed files with 19 additions and 5 deletions

12
sysproc_darwin.go Normal file
View file

@ -0,0 +1,12 @@
package main
import (
"os/exec"
"syscall"
)
func setCommandSysProcAttr(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
}

View file

@ -1,5 +1,3 @@
//go:build !windows
package main
import (
@ -7,9 +5,6 @@ import (
"syscall"
)
// setCommandSysProcAttr sets platform-specific process attributes.
// On Linux: sets a new process group so child processes don't receive
// terminal signals meant for the parent, and enables proper cleanup.
func setCommandSysProcAttr(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,

7
sysproc_windows.go Normal file
View file

@ -0,0 +1,7 @@
package main
import "os/exec"
func setCommandSysProcAttr(cmd *exec.Cmd) {
// Windows does not use Setpgid
}