lifecycle

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignalMessage

func SignalMessage(sig os.Signal) string

SignalMessage returns a human-readable message for a signal. SIGINT → "Interrupted. Cleaning up..." SIGTERM → "Terminating. Cleaning up..." other → "Signal received. Cleaning up..."

func TrapSignals

func TrapSignals(ctx context.Context, cancel context.CancelFunc, cleanupFn func(), timeout time.Duration)

TrapSignals registers SIGINT and SIGTERM handlers. On signal: prints a message via ui.Warn, calls cancel(), runs cleanupFn in a goroutine, waits up to timeout for it to complete, then exits with the conventional signal exit code (130 for SIGINT, 143 for SIGTERM).

Types

This section is empty.

Jump to

Keyboard shortcuts

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