mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 05:46:34 +02:00
syscall.SysProcAttr.Setsid is posix-only — unknown field on windows. Extracted the detach-on-start logic into a detachChild function variable, implemented in botcmd_unix.go (Setsid) and botcmd_windows.go (DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP creation flags).
17 lines
361 B
Go
17 lines
361 B
Go
//go:build !windows
|
|
|
|
package agent
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
// detachChild runs the bot in a new session so tty signals sent to
|
|
// the parent shell (SIGINT when the terminal closes, SIGHUP on
|
|
// logout) don't propagate to the detached bot.
|
|
func init() {
|
|
detachChild = func(cmd *exec.Cmd) {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
|
}
|
|
}
|