Skip to content

Commit

Permalink
cannot catch SIGKILL
Browse files Browse the repository at this point in the history
  • Loading branch information
magiconair committed Dec 10, 2017
1 parent 83b876c commit c3b75f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exit/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ var wg sync.WaitGroup
var quit = make(chan bool)

// Listen registers an exit handler which is called on
// SIGINT/SIGKILL/SIGTERM or when Exit/Fatal/Fatalf is called.
// SIGINT/SIGTERM or when Exit/Fatal/Fatalf is called.
func Listen(fn func(os.Signal)) {
wg.Add(1)
go func() {
defer wg.Done()
// we use buffered to mitigate losing the signal
sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, os.Interrupt, os.Kill, syscall.SIGTERM)
signal.Notify(sigchan, os.Interrupt, syscall.SIGTERM)

var sig os.Signal
select {
Expand Down

0 comments on commit c3b75f6

Please sign in to comment.