actions

package
v0.0.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultGracePeriod = 30 * time.Second
)

Variables

This section is empty.

Functions

func FindPID

func FindPID(processName string) (int, error)

FindPID scans /proc for a process whose argv[0] matches processName. Requires shareProcessNamespace: true in the Kubernetes pod spec.

func GracefulStop

func GracefulStop(ctx context.Context, signaler ProcessSignaler, processName string, gracePeriod time.Duration) error

GracefulStop sends SIGTERM to the named process, waits up to gracePeriod for it to exit, then escalates to SIGKILL. When signaler is nil the package-level functions are used directly.

func PIDAlive

func PIDAlive(pid int) bool

PIDAlive returns true if the process is still running.

func SignalPID

func SignalPID(pid int, sig syscall.Signal) error

SignalPID sends a signal to the given process.

Types

type ProcessSignaler

type ProcessSignaler interface {
	FindPID(processName string) (int, error)
	Signal(pid int, sig syscall.Signal) error
	Alive(pid int) bool
}

ProcessSignaler abstracts process discovery and signaling for testability.

Jump to

Keyboard shortcuts

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