summaryrefslogtreecommitdiff
path: root/pkg/signal/signal.go
blob: 63337542d7b7553415fc647f9a2f45faee8585db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package signal

import (
	"os"
	"os/signal"
)

func CatchAll(sigc chan os.Signal) {
	handledSigs := []os.Signal{}
	for _, s := range SignalMap {
		handledSigs = append(handledSigs, s)
	}
	signal.Notify(sigc, handledSigs...)
}

func StopCatch(sigc chan os.Signal) {
	signal.Stop(sigc)
	close(sigc)
}