Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignalMessage ¶
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, exitFn func(int))
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 calls exitFn with the conventional signal exit code (130 for SIGINT, 143 for SIGTERM). Pass os.Exit as exitFn in production; pass a stub in tests.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.