]> git.saurik.com Git - redis.git/commitdiff
redis-cli in REPL mode is now able to send the same command multiple times, prefixing...
authorantirez <antirez@gmail.com>
Sat, 28 May 2011 13:13:55 +0000 (15:13 +0200)
committerantirez <antirez@gmail.com>
Sat, 28 May 2011 13:13:55 +0000 (15:13 +0200)
src/redis-cli.c

index c2d8d9a3812dc9fe9340ddc8b8f7b64b89795282..650eafe38b037c9e10c026e1f01d4a642eb9df3c 100644 (file)
@@ -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();
                     }