Skip to content

Commit

Permalink
Fixes (#7)
Browse files Browse the repository at this point in the history
Fix #7 delimiting interrupt type signals only
  • Loading branch information
segator authored Jun 23, 2021
1 parent 043d896 commit 476f532
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/src/go/toscactl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ package main
import (
"context"
_ "embed"
"fmt"
log "github.com/sirupsen/logrus"
"os"
"os/signal"
"toscactl/cli"
)

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()
}
Expand Down

0 comments on commit 476f532

Please sign in to comment.