childreap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDefer = 60 * time.Second

MaxDefer is how long reaping waits before blocking new subprocesses.

View Source
const MaxDrain = 30 * time.Second

MaxDrain is how long a forced drain waits before abandoning the reap.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reaper

type Reaper struct {
	// contains filtered or unexported fields
}

Reaper collects orphaned children. The zero value is not usable; call New.

func New

func New() *Reaper

func (*Reaper) CombinedOutput

func (r *Reaper) CombinedOutput(cmd *exec.Cmd) ([]byte, error)

CombinedOutput is RunCommand for callers that need cmd.CombinedOutput.

func (*Reaper) Enter

func (r *Reaper) Enter() func()

Enter prevents reaping until the returned function is called.

defer reaper.Enter()()

Do not use Enter for long-lived subprocesses; they prevent reaping.

func (*Reaper) Run

func (r *Reaper) Run(ctx context.Context)

Run reaps until ctx ends. Call it once in its own goroutine.

func (*Reaper) RunCommand

func (r *Reaper) RunCommand(cmd *exec.Cmd) error

RunCommand runs cmd while excluding child reaping.

Jump to

Keyboard shortcuts

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