interrupt

package
v6.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 6 Imported by: 0

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

func Push(fn func(os.Signal)) (pop func())

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

func RunHandlers(sig os.Signal)

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.

Jump to

Keyboard shortcuts

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