summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/main.go b/main.go
index 6da8e93..84a0761 100644
--- a/main.go
+++ b/main.go
@@ -42,9 +42,14 @@ func main() {
go server.Start()
defer server.Stop()
+ await(syscall.SIGTERM, syscall.SIGINT)
+}
+
+func await(signals ...syscall.Signal) {
listener := make(chan os.Signal)
- signal.Notify(listener, syscall.SIGTERM)
- signal.Notify(listener, syscall.SIGINT)
+ for _, s := range signals {
+ signal.Notify(listener, s)
+ }
sig := <-listener
- log.Printf("Cleaning up due to OS signal '%v'\n", sig)
+ log.Printf("Received OS signal '%v'\n", sig)
}