Create portable signalMap

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
This commit is contained in:
Guillaume J. Charmes 2014-03-10 13:50:16 -07:00
parent db6b150d99
commit 16d0b6b959
5 changed files with 121 additions and 150 deletions

View file

@ -5,6 +5,14 @@ import (
"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)