Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinBefore ¶
func JoinBefore(fns ...cli.BeforeFunc) cli.BeforeFunc
func NewInterruptHandler ¶
NewInterruptHandler returns a new interrupt handler that will invoke cancel if any of the signals provided are received.
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.