From 4d19e3443cc3a36bd51684099152d89e18c45afa Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 28 May 2011 15:13:55 +0200 Subject: [PATCH] redis-cli in REPL mode is now able to send the same command multiple times, prefixing the command with a number as in "10 ping" --- src/redis-cli.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index c2d8d9a3..650eafe3 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -680,12 +680,22 @@ static void repl() { linenoiseClearScreen(); } else { long long start_time = mstime(), elapsed; + int repeat, skipargs = 0; - if (cliSendCommand(argc,argv,1) != REDIS_OK) { + repeat = atoi(argv[0]); + if (repeat) { + skipargs = 1; + } else { + repeat = 1; + } + + if (cliSendCommand(argc-skipargs,argv+skipargs,repeat) + != REDIS_OK) + { cliConnect(1); - /* If we still cannot send the command, - * print error and abort. */ + /* If we still cannot send the command print error. + * We'll try to reconnect the next time. */ if (cliSendCommand(argc,argv,1) != REDIS_OK) cliPrintContextError(); } -- GitLab