Help us shape the future of Go! Take the 2026 Go Developer Survey

interrupt

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package interrupt maps Ctrl-C onto a session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher: while a turn runs, the first Ctrl-C stops its loop after the current iteration and a second aborts outright. At the prompt between turns, one Ctrl-C ends the session.

func NewWatcher

func NewWatcher(stderr io.Writer) *Watcher

func (*Watcher) Aborted

func (w *Watcher) Aborted() bool

func (*Watcher) Track added in v0.2.7

func (w *Watcher) Track(l *loop.Loop)

Track says which loop a press stops: the turn's loop, or nil at the prompt.

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context, cancel context.CancelFunc)

Watch handles presses until ctx ends. cancel ends the whole session.

Jump to

Keyboard shortcuts

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