command

package
v0.0.0-...-1ab0d2a Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App

func App() *cli.App

func Attach

func Attach(c *cli.Context) error

func NewInterruptHandler

func NewInterruptHandler(cancel context.CancelFunc, sigs ...os.Signal) io.Closer

NewInterruptHandler returns a new interrupt handler that will invoke cancel if any of the signals provided are received.

func StartSession

func StartSession(c *cli.Context) error

Types

type InterruptHandler

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

InterruptHandler helps set up an interrupt handler that can be cleanly shut down through the io.Closer interface.

func (*InterruptHandler) Close

func (ih *InterruptHandler) Close() error

Close closes its signal receiver and waits for its handlers to exit cleanly.

func (*InterruptHandler) Handle

func (ih *InterruptHandler) Handle(handler handlerFunc, sigs ...os.Signal)

Handle starts handling the given signals, and will call the handler callback function each time a signal is catched. The function is passed the number of times the handler has been triggered in total, as well as the handler itself, so that the handling logic can use the handler's wait group to ensure clean shutdown when Close() is called.

Jump to

Keyboard shortcuts

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