func handleExitSignals() { var sig signal.Signal SIGTERM := signal.Signal(signal.SIGTERM) SIGINT := signal.Signal(signal.SIGINT) for { sig = <-signal.Incoming if sig == SIGTERM || sig == SIGINT { RunExitHandlers() os.Exit(0) break } } }
func InstallCtrlCPanic() { go func() { for s := range signal.Incoming { if s == signal.Signal(signal.SIGINT) { panic("Ctrl-C signalled") } } }() }
func InstallCtrlCPanic() { go func() { for s := range signal.Incoming { if s == signal.Signal(signal.SIGINT) { fmt.Printf(term.FgRed+"sig: %s\n"+term.Reset, s) panic("signal") } } }() }