reaper

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &Monitor{
	subscribers: make(map[chan runc.Exit]*subscriber),
}

Default is the default monitor initialized for the package

View Source
var ErrNoSuchProcess = errors.New("no such process")

ErrNoSuchProcess is returned when the process no longer exists

Functions

func GetSubreaper

func GetSubreaper() (int, error)

GetSubreaper returns the subreaper setting for the calling process

func Reap

func Reap() error

Reap should be called when the process receives an SIGCHLD. Reap will reap all exited processes and close their wait channels

func SetSubreaper

func SetSubreaper(i int) error

SetSubreaper sets the value i as the subreaper setting for the calling process

Types

type Monitor

type Monitor struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Monitor monitors the underlying system for process status changes

func (*Monitor) Start

func (m *Monitor) Start(c *exec.Cmd) (chan runc.Exit, error)

Start starts the command a registers the process with the reaper

func (*Monitor) Subscribe

func (m *Monitor) Subscribe() chan runc.Exit

Subscribe to process exit changes

func (*Monitor) Unsubscribe

func (m *Monitor) Unsubscribe(c chan runc.Exit)

Unsubscribe to process exit changes

func (*Monitor) Wait

func (m *Monitor) Wait(c *exec.Cmd, ec chan runc.Exit) (int, error)

Wait blocks until a process is signal as dead. User should rely on the value of the exit status to determine if the command was successful or not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL