From 476f532c0e814970565e822172dc556b45a4bb76 Mon Sep 17 00:00:00 2001 From: Isaac Aymerich Date: Wed, 23 Jun 2021 18:07:05 +0200 Subject: [PATCH] Fixes (#7) Fix #7 delimiting interrupt type signals only --- client/src/go/toscactl/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/go/toscactl/main.go b/client/src/go/toscactl/main.go index 3ea4092..abe5c45 100644 --- a/client/src/go/toscactl/main.go +++ b/client/src/go/toscactl/main.go @@ -3,6 +3,7 @@ package main import ( "context" _ "embed" + "fmt" log "github.com/sirupsen/logrus" "os" "os/signal" @@ -10,13 +11,14 @@ import ( ) func main() { - signalchan := make (chan os.Signal) - signal.Notify(signalchan) + signalchan := make (chan os.Signal,1) + signal.Notify(signalchan,os.Interrupt,os.Kill) ctx, stop :=context.WithCancel(context.Background()) defer stop() go func() { select { case <-signalchan: + fmt.Println() log.Info("Program interruption detected... closing...") stop() }