reaper
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package reaper contains logic for reaping subprocesses. It isspecifically used in the agent to avoid the accumulation ofzombie processes.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcForkReap¶
ForkReap spawns a goroutine that reaps children. In order to avoidcomplications with spawning `exec.Commands` in the same process thatis reaping, we forkexec a child process. This prevents a race betweenthe reaper and an exec.Command waiting for its process to complete.The provided 'pids' channel may be nil if the caller does not care about thereaped children PIDs.
funcIsInitProcess¶
func IsInitProcess()bool
IsInitProcess returns true if the current process's PID is 1.
Types¶
typeOption¶
type Option func(o *options)
funcWithCatchSignals¶
WithCatchSignals sets the signals that are caught and forwarded to thechild process. By default no signals are forwarded.
funcWithExecArgs¶
WithExecArgs specifies the exec arguments for the fork exec call.By default the same arguments as the parent are used as dictated byos.Args. Since ForkReap calls a fork-exec it is the responsibility ofthe caller to avoid fork-bombing oneself.
funcWithPIDCallback¶
func WithPIDCallback(ch reap.PidCh)Option
WithPIDCallback sets the channel that reaped child process PIDs are pushedonto.