fix: macos launcher

This commit is contained in:
Carlos Florêncio
2026-01-14 01:51:37 +00:00
parent 9e04b75ddf
commit 6a0590fa4e
3 changed files with 26 additions and 8 deletions
@@ -133,13 +133,9 @@ func (l *Launcher) Start(ctx context.Context) error {
)
// Set process attributes:
// - Pdeathsig: kernel sends SIGTERM to child when parent dies (crash protection)
// - Setpgid: create new process group so Ctrl+C doesn't propagate directly
// (we handle shutdown ourselves via Stop())
l.cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: syscall.SIGTERM,
Setpgid: true, // Don't inherit parent's process group
}
// - Pdeathsig on Linux: kernel sends SIGTERM to child when parent dies.
// - Setpgid: create new process group so Ctrl+C doesn't propagate directly.
l.cmd.SysProcAttr = buildSysProcAttr()
// Capture stdout and stderr
stdout, err := l.cmd.StdoutPipe()
@@ -332,4 +328,3 @@ func (l *Launcher) monitorExit() {
close(l.exited)
}
@@ -0,0 +1,11 @@
//go:build !linux
package launcher
import "syscall"
func buildSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
Setpgid: true,
}
}
@@ -0,0 +1,12 @@
//go:build linux
package launcher
import "syscall"
func buildSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
Pdeathsig: syscall.SIGTERM,
Setpgid: true,
}
}