Fix redis-cli pubsub_mode and connect minor prompt / crash issue (#12571)
When entering pubsub mode and using the redis-cli only connect command, we need to reset pubsub_mode because we switch to a different connection. This will affect the prompt when the connection is successful, and redis-cli will crash when the connect fails: ``` 127.0.0.1:6379> subscribe ch 1) "subscribe" 2) "ch" 3) (integer) 1 127.0.0.1:6379(subscribed mode)> connect 127.0.0.1 6380 127.0.0.1:6380(subscribed mode)> ping PONG 127.0.0.1:6380(subscribed mode)> connect a b Could not connect to Redis at a:0: Name or service not known Segmentation fault ``` (cherry picked from commit 4de4fcf280648519239927d408624ea34953c0e0)
This commit is contained in:
parent
ba113c8337
commit
8c6ebf84ae
@ -1657,6 +1657,7 @@ static int cliConnect(int flags) {
|
||||
redisFree(context);
|
||||
config.dbnum = 0;
|
||||
config.in_multi = 0;
|
||||
config.pubsub_mode = 0;
|
||||
cliRefreshPrompt();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user