summaryrefslogtreecommitdiff
path: root/pkg/signal/signal.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/signal/signal.go')
-rw-r--r--pkg/signal/signal.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/signal/signal.go b/pkg/signal/signal.go
new file mode 100644
index 0000000000..63337542d7
--- /dev/null
+++ b/pkg/signal/signal.go
@@ -0,0 +1,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)
+}