--- title: internal/proclife description: Go API reference for the proclife package. --- # proclife ```go import "github.com/jbcom/radioactive-ralph/internal/proclife" ``` Package proclife exposes the cross\-platform parent\-death primitives that back up variantpool's lifeline pipe. The lifeline pipe alone \(see internal/variantpool\) is portable and sufficient — children that honor EOF\-on\-FD\-3 self\-terminate when the parent dies, regardless of OS. This package adds OS\-level defenses for children that don't cooperate: - Linux: PR\_SET\_PDEATHSIG via syscall.SysProcAttr.Pdeathsig. Kernel signals the child when the parent exits. - macOS: kqueue NOTE\_EXIT on the parent pid. Child registers a watch and exits when the kevent fires. - Windows: Job Objects with JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE. Kernel kills every process in the job when the job handle is released. Each implementation is a single file behind a go:build tag. Callers import this package and call Attach\(cmd\) before Start. Attach is best\-effort: if the OS primitive is unavailable or fails, the function returns nil \(the lifeline pipe remains the primary safety net, not this\). Errors surface only in platform tests. ## Index - [func Attach\(cmd \*exec.Cmd\) error](<#Attach>) - [func PostStart\(cmd \*exec.Cmd\) error](<#PostStart>) ## func [Attach]() ```go func Attach(cmd *exec.Cmd) error ``` Attach configures the \(unstarted\) command with the strongest parent\-death primitive available on this OS. Callers must call Attach BEFORE cmd.Start\(\). On POSIX this is a one\-liner that extends cmd.SysProcAttr. On Windows it's a no\-op at Attach\-time; the Job Object setup happens in a separate step after cmd.Start\(\) on that platform. ## func [PostStart]() ```go func PostStart(cmd *exec.Cmd) error ``` PostStart is called after cmd.Start\(\) for platforms that need to bind the child to the parent's lifetime at process\-handle level \(Windows\). POSIX implementations make it a no\-op. Generated by [gomarkdoc]()