e75c8b37c8
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
23 lines
720 B
Go
23 lines
720 B
Go
//go:build linux
|
|
|
|
package launcher
|
|
|
|
import "syscall"
|
|
|
|
// buildSysProcAttr configures the child's process attributes. Pdeathsig is
|
|
// kill-path #2 of design 01's kill-paths list: it fires from the kernel on
|
|
// ANY parent exit, including SIGKILL, so it must be omitted entirely when
|
|
// the agent-survival capability is engaged for this launch
|
|
// (AC-EXECUTORS-SURVIVAL-001.2 forbids depending on any backend shutdown
|
|
// step). Setpgid stays set regardless -- it isolates agentctl from terminal
|
|
// Ctrl+C, unrelated to survival.
|
|
func buildSysProcAttr(survivalEnabled bool) *syscall.SysProcAttr {
|
|
attr := &syscall.SysProcAttr{
|
|
Setpgid: true,
|
|
}
|
|
if !survivalEnabled {
|
|
attr.Pdeathsig = syscall.SIGTERM
|
|
}
|
|
return attr
|
|
}
|