Package signals makes it easier to catch SIGTERM.
func HandleInterrupt ¶
func HandleInterrupt(fn func()) (stopper func())
HandleInterrupt calls 'fn' in a separate goroutine on SIGTERM or Ctrl+C.
When SIGTERM or Ctrl+C comes for a second time, logs to stderr and kills the process immediately via os.Exit(1).
Returns a callback that can be used to remove the installed signal handlers.