Skip to content

Commit

Permalink
Fix default signal
Browse files Browse the repository at this point in the history
  • Loading branch information
xorkevin committed Mar 14, 2023
1 parent ccfaeb8 commit 693b6b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ func (c *Cmd) runInt(f func(ctx context.Context) error) {
if conf := c.opts.TermConfig; conf != nil {
signals = conf.TermSignals
}
if len(signals) == 0 {
signals = []os.Signal{os.Interrupt}
}
ksignal.Wait(ctx, signals...)

cancel()
Expand Down
3 changes: 3 additions & 0 deletions util/ksignal/ksignal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (

// Wait blocks until a signal is received
func Wait(ctx context.Context, signals ...os.Signal) {
if len(signals) == 0 {
signals = []os.Signal{os.Interrupt}
}
notifyCtx, stop := signal.NotifyContext(ctx, signals...)
defer stop()
<-notifyCtx.Done()
Expand Down

0 comments on commit 693b6b1

Please sign in to comment.