pkg/signal/signal.go
Guillaume J. Charmes 2433bf6372 Make docker use the signal pkg with strings
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
2014-03-10 17:36:47 -07:00

19 lines
299 B
Go

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)
}