From d1a0509bf0b3573c444b2d14863107f785bbf47d Mon Sep 17 00:00:00 2001 From: "Schiefelbein, Andrew" Date: Fri, 31 Jul 2020 08:48:13 -0500 Subject: [PATCH] Fixed the ctl + c exit The removal of electron was a bit too expeditious and removed some of the things that controled the exit of the system Change-Id: I8ad1ab83fc3ecbcbe07bdd949bc01fd8a0889e00 --- internal/commands/root.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/commands/root.go b/internal/commands/root.go index a91b4e8..716d1b7 100644 --- a/internal/commands/root.go +++ b/internal/commands/root.go @@ -80,7 +80,14 @@ func launch(cmd *cobra.Command, args []string) { webservice.SendAlert(configs.Info, fmt.Sprintf("%s", err), true) } - // start the web service and related sundries + // start webservice and listen for the the ctl + c to exit + c := make(chan os.Signal) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + go func() { + <-c + log.Println("Exiting the webservice") + os.Exit(0) + }() webservice.WebServer() // cancel running plugins and wait for shut down