Documentation ¶
Overview ¶
Package reap configures the go process as a process supervisor. A process supervisor is the init process for subprocesses and terminates all subprocesses when the foreground process exits.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Reap)
func WithDeadline ¶
WithDeadline sets a timeout for subprocesses to exit after the foreground process exits. When the deadline is reached, subprocesses are signaled with SIGKILL.
func WithDelay ¶
WithDelay waits the specified duration before resending signals after the foreground process exits.
func WithDisableSetuid ¶
WithDisableSetuid disallows unkillable setuid subprocesses.
func WithSignal ¶
WithSignal sets the signal sent to subprocesses after the foreground process exits.
type Reap ¶
func (*Reap) Supervise ¶
Supervise creates a subprocess, terminating all subprocesses when the foreground process exits.
Example ¶
package main import ( "fmt" "github.com/msantos/goreap/reap" ) func main() { r := reap.New() status, err := r.Supervise([]string{"env", "-i"}, []string{"FOO=bar"}) if err != nil { fmt.Println(err) return } fmt.Println("exit status:", status) }
Output: exit status: 0