sonic-telemetry
sonic-telemetry copied to clipboard
Fix Ctrl+C to terminate dialout_client_cli
Ctrl+C cannot terminate dialout_client_cli until dialout_client received the Redis Pub/Sub message.
The reason is that the code to check the ctx.Done() is behind the code to receive message.
Therefore, I move the checking code in order to terminate the program even if there is no Redis Pub/Sub message received.
retest this please.
retest this please.
Retest this please
retest this please
I noticed this issue as well but I thought this would fix it instead:
diff --git a/dialout/dialout_client_cli/dialout_client_cli.go b/dialout/dialout_client_cli/dialout_client_cli.go
index d8d9014..a5df70b 100644
--- a/dialout/dialout_client_cli/dialout_client_cli.go
+++ b/dialout/dialout_client_cli/dialout_client_cli.go
@@ -34,7 +34,7 @@ func main() {
flag.Parse()
ctx, cancel := context.WithCancel(context.Background())
// Terminate on Ctrl+C
- go func() {
+ defer func() {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c