Commit 58f1d446 authored by antirez's avatar antirez
Browse files

redis-cli: really connect to the right server.

I recently introduced populating the autocomplete help array with the
COMMAND command if available. However this was performed before parsing
the arguments, defaulting to instance 6379. After the connection is
performed it remains stable.

The effect is that if there is an instance running on port 6339,
whatever port you specify is ignored and 6379 is connected to instead.
The right port will be selected only after a reconnection.

Close #3314.
parent b6007b32
...@@ -2591,13 +2591,16 @@ int main(int argc, char **argv) { ...@@ -2591,13 +2591,16 @@ int main(int argc, char **argv) {
else else
config.output = OUTPUT_STANDARD; config.output = OUTPUT_STANDARD;
config.mb_delim = sdsnew("\n"); config.mb_delim = sdsnew("\n");
cliInitHelp();
cliIntegrateHelp();
firstarg = parseOptions(argc,argv); firstarg = parseOptions(argc,argv);
argc -= firstarg; argc -= firstarg;
argv += firstarg; argv += firstarg;
/* Initialize the help and, if possible, use the COMMAND command in order
* to retrieve missing entries. */
cliInitHelp();
cliIntegrateHelp();
/* Latency mode */ /* Latency mode */
if (config.latency_mode) { if (config.latency_mode) {
if (cliConnect(0) == REDIS_ERR) exit(1); if (cliConnect(0) == REDIS_ERR) exit(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment