From a924483398f9d9c321dcc457546f66c81d78a8a9 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 19 Oct 2021 20:03:01 +0200 Subject: [PATCH] Fix ctrl-c not working when waiting for initial value on mqtt --- cmd/root.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 5e97d7274..d66b2e05a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -245,7 +245,11 @@ func run(cmd *cobra.Command, args []string) { <-signalC // wait for signal close(stopC) // signal loop to end - <-exitC // wait for loop to end + + select { + case <-exitC: // wait for loop to end + case <-time.NewTimer(conf.Interval).C: // wait max 1 period + } os.Exit(1) }()