Skip to content

Commit

Permalink
Don't use raw output if it multi-exec context
Browse files Browse the repository at this point in the history
Signed-off-by: xbasel <[email protected]>
  • Loading branch information
xbasel committed Feb 26, 2025
1 parent 7ea55bc commit fdb0f9d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/valkey-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1989,10 +1989,6 @@ static sds cliFormatReplyRaw(redisReply *r) {
break;
default: fprintf(stderr, "Unknown reply type: %d\n", r->type); exit(1);
}
/* Append newline only if the last character isn't already '\n' */
if (sdslen(out) > 0 && out[sdslen(out) - 1] != '\n') {
out = sdscatlen(out, "\n", 1);
}
return out;
}

Expand Down Expand Up @@ -2342,7 +2338,8 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
if (context == NULL) return REDIS_ERR;

output_raw = 0;
if (!strcasecmp(command, "info") || !strcasecmp(command, "lolwut") ||
if ( !config.in_multi &&
(!strcasecmp(command, "info") || !strcasecmp(command, "lolwut") ||
(argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats")) ||
(argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats-key")) ||
(argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "client-eviction")) ||
Expand All @@ -2356,7 +2353,7 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
(argc == 2 && !strcasecmp(command, "latency") && !strcasecmp(argv[1], "doctor")) ||
/* Format PROXY INFO command for Cluster Proxy:
* https://github.com/artix75/redis-cluster-proxy */
(argc >= 2 && !strcasecmp(command, "proxy") && !strcasecmp(argv[1], "info"))) {
(argc >= 2 && !strcasecmp(command, "proxy") && !strcasecmp(argv[1], "info")))) {
output_raw = 1;
}

Expand Down

0 comments on commit fdb0f9d

Please sign in to comment.