Documentation
¶
Overview ¶
Package interrupt decides what Ctrl-C and SIGTERM do. By default they end the CLI with 130 or 143 and no stack trace. Code that must clean up first, such as `run --wait` cancelling the experiment it started, pushes a handler for as long as it runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interrupted ¶ added in v6.1.0
func Interrupted() bool
Interrupted reports whether the CLI was interrupted. Code that starts something to clean up checks it after pushing its handler, which may have come too late to run.
func Push ¶
Push runs fn when the CLI is interrupted, before it exits, until the returned pop is called. Handlers run most recent first.
func Reset ¶ added in v6.1.0
func Reset()
Reset forgets an interrupt, for tests that stand in for one with RunHandlers.
func RunHandlers ¶
RunHandlers runs what is registered for sig, most recent first, without exiting. The signal handler calls it before exiting; tests call it to stand in for Ctrl-C.
Types ¶
This section is empty.