Esempio n. 1
0
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
		}
	}
}
Esempio n. 2
0
func InstallCtrlCPanic() {
	go func() {
		for s := range signal.Incoming {
			if s == signal.Signal(signal.SIGINT) {
				panic("Ctrl-C signalled")
			}
		}
	}()
}
Esempio n. 3
0
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")
			}
		}
	}()
}