Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

redis-cli: fix prompt after shutdown command #851

Closed
wants to merge 1 commit into from

3 participants

Dov Murik Matt Stancliff moreaki
Dov Murik

Fix redis-cli prompt to state not connected after a SHUTDOWN command is sent.

Original scenario (before fix):

redis 127.0.0.1:6379> KEYS *
1) "aaa"
redis 127.0.0.1:6379> SHUTDOWN
redis 127.0.0.1:6379> KEYS *
redis 127.0.0.1:6379> GET aaa
redis 127.0.0.1:6379> 

Same scenario after redis-cli fix:

redis 127.0.0.1:6379> KEYS *
1) "aaa"
redis 127.0.0.1:6379> SHUTDOWN
not connected> KEYS *
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> GET aaa
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> 
Dov Murik redis-cli: fix prompt after shutdown command
Fix redis-cli prompt to state "not connected" after a SHUTDOWN command
is sent.
39e04e4
moreaki

In my humble opinion a very useful patch and probably the intended invariant of SHUTDOWN on the CLI part. I have just verified it with the newest unstable branch. Do you mind rebasing your patch (I haven't tested if git still applies it, though it should)?

@antirez: I believe this should be merged.

Matt Stancliff
Collaborator

Fixed in 233d24a

Matt Stancliff mattsta closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 26, 2012
  1. redis-cli: fix prompt after shutdown command

    Dov Murik authored
    Fix redis-cli prompt to state "not connected" after a SHUTDOWN command
    is sent.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/redis-cli.c
5 src/redis-cli.c
View
@@ -487,8 +487,11 @@ static int cliReadReply(int output_raw_strings) {
int output = 1;
if (redisGetReply(context,&_reply) != REDIS_OK) {
- if (config.shutdown)
+ if (config.shutdown) {
+ redisFree(context);
+ context = NULL;
return REDIS_OK;
+ }
if (config.interactive) {
/* Filter cases where we should reconnect */
if (context->err == REDIS_ERR_IO && errno == ECONNRESET)
Something went wrong with that request. Please try again.