Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Fix Ctrl+C to terminate dialout_client_cli #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MuLinForest
Copy link
Contributor

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.

@renukamanavalan
Copy link

retest this please.

1 similar comment
@renukamanavalan
Copy link

retest this please.

@jleveque jleveque added the Bug label Jan 27, 2020
@jleveque
Copy link
Contributor

Retest this please

@gord1306
Copy link

gord1306 commented Feb 4, 2020

retest this please

@seiferteric
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants