From e10c5444e79f8f6ce24112175dd42afb8d0b067a Mon Sep 17 00:00:00 2001 From: Matt Stancliff Date: Fri, 17 Oct 2014 08:21:16 -0500 Subject: [PATCH] redis-cli: ignore SIGPIPE network errors Closes #2066 --- src/redis-cli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 07bcf0a04..34070ab80 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -524,7 +524,8 @@ static int cliReadReply(int output_raw_strings) { } if (config.interactive) { /* Filter cases where we should reconnect */ - if (context->err == REDIS_ERR_IO && errno == ECONNRESET) + if (context->err == REDIS_ERR_IO && + (errno == ECONNRESET || errno == EPIPE)) return REDIS_ERR; if (context->err == REDIS_ERR_EOF) return REDIS_ERR; @@ -1914,6 +1915,8 @@ int main(int argc, char **argv) { argc -= firstarg; argv += firstarg; + signal(SIGPIPE, SIG_IGN); + /* Latency mode */ if (config.latency_mode) { if (cliConnect(0) == REDIS_ERR) exit(1);