Documentation
¶
Overview ¶
Package process provides handles on long-lived processes such as VMMs, started or adopted, that report when the process exits.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExitStatusUnknown = errors.New("exit status unavailable for an adopted process")
ErrExitStatusUnknown is the exit error of an adopted process. Only a process's parent can collect its exit status, and an adopted process was started by a previous daemon.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process is a handle on a supervised process. Its methods are safe for concurrent use.
func Attach ¶
Attach adopts a running process the daemon did not start, such as a VMM that outlived the previous daemon. It pins the process with a pidfd and checks that arg is on its command line, so a reused PID is not mistaken for it.
func Start ¶
Start starts cmd and returns a handle on it. The process is reaped as soon as it exits, so it never lingers as a zombie, and its exit status is kept for Err.
func (*Process) Done ¶
func (p *Process) Done() <-chan struct{}
Done returns a channel that is closed when the process exits.
func (*Process) Err ¶
Err reports why the process exited: nil for a clean exit, an *exec.ExitError for a child that failed or was killed, and ErrExitStatusUnknown for an adopted process. It must only be called after Done is closed.