Add prompt when Ctrl-C pressed (#702)

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 <wen.hui.ware@gmail.com>
This commit is contained in:
Wen Hui 2024-06-28 22:05:40 -04:00 committed by GitHub
parent b59762f734
commit 7415a576a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);