moby--moby/pkg/signal/signal.go

20 lines
299 B
Go
Raw Normal View History

package signal
2013-10-29 18:59:08 +00:00
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...)
}
2013-10-29 18:59:08 +00:00
func StopCatch(sigc chan os.Signal) {
signal.Stop(sigc)
close(sigc)
}