reaper

package
v0.50.8 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package reaper provides zombie process detection and reaping for worker subprocesses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Interval is how often the reaper checks for zombies. Defaults to 30s if zero.
	Interval time.Duration

	// OnReap is called on each reap cycle (before per-PID callbacks).
	// Used for periodic-check testing without a detector.
	OnReap func()

	// Detector provides zombie PID discovery. If nil, the default syscall-based
	// detector is used on Unix, and a no-op detector is used elsewhere.
	Detector ZombieDetector

	// OnReapPID is called when a zombie PID is reaped. Optional.
	OnReapPID func(pid int)
}

Config holds configuration for the Reaper.

type Reaper

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

Reaper periodically detects and reaps zombie child processes.

func New

func New(cfg Config) *Reaper

New creates a new Reaper with the given configuration.

func (*Reaper) Start

func (r *Reaper) Start(ctx context.Context) error

Start begins the reaper goroutine, which runs until ctx is cancelled. Returns an error if the reaper is already running. @AX:ANCHOR[AUTO]: public lifecycle API — Start/Wait form the goroutine lifecycle contract; callers (loop_lifecycle.go) depend on this pair

func (*Reaper) Wait

func (r *Reaper) Wait() error

Wait blocks until the reaper goroutine exits and returns any error.

type ZombieDetector

type ZombieDetector interface {
	// DetectZombies returns a list of zombie PIDs.
	DetectZombies() []int
}

ZombieDetector detects zombie child processes.

Jump to

Keyboard shortcuts

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