mirror of https://mirror.osredm.com/root/redis.git
Fix a harmless bug when using monitor in redis-cli with wrong reply (#9875)
When we use monitor in redis-cli but encounter an error reply, we will get stuck until we press Ctrl-C to quit. This is a harmless bug. It might be useful if we add parameters to monitor in the future, suck as monitoring only selected db. before: ``` 127.0.0.1:6379> monitor wrong (error) ERR wrong number of arguments for 'monitor' command or subcommand ^C(9.98s) 127.0.0.1:6379> ``` after: ``` 127.0.0.1:6379> monitor wrong (error) ERR wrong number of arguments for 'monitor' command or subcommand 127.0.0.1:6379> ```
This commit is contained in:
parent
0e5b813ef9
commit
e3c0ea1cb4
|
@ -1347,6 +1347,10 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
|
|||
do {
|
||||
if (cliReadReply(output_raw) != REDIS_OK) exit(1);
|
||||
fflush(stdout);
|
||||
|
||||
/* This happens when the MONITOR command returns an error. */
|
||||
if (config.last_cmd_type == REDIS_REPLY_ERROR)
|
||||
config.monitor_mode = 0;
|
||||
} while(config.monitor_mode);
|
||||
zfree(argvlen);
|
||||
return REDIS_OK;
|
||||
|
|
Loading…
Reference in New Issue