mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Make redis-cli grep friendly in pubsub mode (#9013)
redis-cli is grep friendly for all commands but SUBSCRIBE/PSUBSCRIBE. it is unable to process output from these commands line by line piped to another program because of output buffering. to overcome this situation I propose to flush stdout each time when it is written with reply from these commands the same way it is already done for all other commands.
This commit is contained in:
parent
1df8c129bc
commit
77d44bb7b4
@ -1435,6 +1435,7 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
|
||||
|
||||
while (config.pubsub_mode) {
|
||||
if (cliReadReply(output_raw) != REDIS_OK) exit(1);
|
||||
fflush(stdout); /* Make it grep friendly */
|
||||
if (config.last_cmd_type == REDIS_REPLY_ERROR) {
|
||||
if (config.push_output) {
|
||||
redisSetPushCallback(context, cliPushHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user