From 7415a576a8c49fdb946ac45aa66f4a462872d277 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Fri, 28 Jun 2024 22:05:40 -0400 Subject: [PATCH] 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 --- src/valkey-cli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/valkey-cli.c b/src/valkey-cli.c index 5d506383c..7e6898643 100644 --- a/src/valkey-cli.c +++ b/src/valkey-cli.c @@ -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);