Skip to content

Instantly share code, notes, and snippets.

@mlsteele
Created January 29, 2018 19:52
Show Gist options
  • Save mlsteele/238fa8f62c9dfd67c339bba3a9fa0578 to your computer and use it in GitHub Desktop.
Save mlsteele/238fa8f62c9dfd67c339bba3a9fa0578 to your computer and use it in GitHub Desktop.
Go intercept and print all signals
func Signalsnoop() {
ch := make(chan os.Signal, 500)
go func() {
for {
s := <-ch
fmt.Printf("SIGNAL: %+v\n", s)
}
}()
signal.Notify(ch)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment