Skip to content

Commit

Permalink
Add prompt when Ctrl-C pressed (#702)
Browse files Browse the repository at this point in the history
When I play the pubsub command in console, I am confused by the
following scenario:


![image](https://github.com/valkey-io/valkey/assets/51993843/c56e3976-1e8f-4053-9abb-16fa05ef6ec4)

The reason is that when I press Ctrl-C, client exits current connection
and reconnects to the server.
Thus I add one prompt message to make everyone clear what it happens.


![image](https://github.com/valkey-io/valkey/assets/51993843/cc620f27-4522-4f34-a7b3-86bcdeedfaba)

---------

Signed-off-by: hwware <[email protected]>
  • Loading branch information
hwware authored Jun 29, 2024
1 parent b59762f commit 7415a57
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/valkey-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,8 @@ static void cliWaitForMessagesOrStdin(void) {
/* Ctrl-C pressed */
config.blocking_state_aborted = 0;
config.pubsub_mode = 0;
printf("Closing current connection. Ready to reconnect to Valkey server... \n");
fflush(stdout);
if (cliConnect(CC_FORCE) != REDIS_OK) {
cliPrintContextError();
exit(1);
Expand Down

0 comments on commit 7415a57

Please sign in to comment.