X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f6bd9122c0692bd76e7c1d90062c50551cd898a5..7eb850ef0e437323e2d84157ddc2e6e82af57bbc:/src/redis-cli.c diff --git a/src/redis-cli.c b/src/redis-cli.c index 1b3c0c74..8d20d1cd 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -711,17 +712,17 @@ static void usage() { " -a Password to use when connecting to the server\n" " -r Execute specified command N times\n" " -i When -r is used, waits seconds per command.\n" -" It is possible to specify sub-second times like -i 0.1.\n" +" It is possible to specify sub-second times like -i 0.1\n" " -n Database number\n" " -x Read last argument from STDIN\n" " -d Multi-bulk delimiter in for raw formatting (default: \\n)\n" " -c Enable cluster mode (follow -ASK and -MOVED redirections)\n" " --raw Use raw formatting for replies (default when STDOUT is not a tty)\n" -" --latency Enter a special mode continuously sampling latency.\n" -" --slave Simulate a slave showing commands received from the master.\n" -" --pipe Transfer raw Redis protocol from stdin to server.\n" -" --bigkeys Sample Redis keys looking for big keys.\n" -" --eval Send an EVAL command using the Lua script at .\n" +" --latency Enter a special mode continuously sampling latency\n" +" --slave Simulate a slave showing commands received from the master\n" +" --pipe Transfer raw Redis protocol from stdin to server\n" +" --bigkeys Sample Redis keys looking for big keys\n" +" --eval Send an EVAL command using the Lua script at \n" " --help Output this help and exit\n" " --version Output version and exit\n" "\n" @@ -1009,7 +1010,7 @@ static void pipeMode(void) { /* Read from socket and feed the hiredis reader. */ do { nread = read(fd,ibuf,sizeof(ibuf)); - if (nread == -1 && errno != EAGAIN) { + if (nread == -1 && errno != EAGAIN && errno != EINTR) { fprintf(stderr, "Error reading from the server: %s\n", strerror(errno)); exit(1); @@ -1052,7 +1053,7 @@ static void pipeMode(void) { ssize_t nwritten = write(fd,obuf+obuf_pos,obuf_len); if (nwritten == -1) { - if (errno != EAGAIN) { + if (errno != EAGAIN && errno != EINTR) { fprintf(stderr, "Error writing to the server: %s\n", strerror(errno)); exit(1); @@ -1232,7 +1233,7 @@ int main(int argc, char **argv) { /* Pipe mode */ if (config.pipe_mode) { - cliConnect(0); + if (cliConnect(0) == REDIS_ERR) exit(1); pipeMode(); }