diff options
author | Jan-Erik Rediger <badboy@archlinux.us> | 2014-12-09 00:57:46 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-12-09 09:01:10 +0100 |
commit | 2f3c8609793d9999ecadd089bc4e319e729ce76b (patch) | |
tree | b118e3c4b9924f8cb431d8a2c7b67cf8f6c23c30 | |
parent | 0c211a1953afeda3d0d45126653e2d4c38bd88cb (diff) | |
download | redis-2f3c8609793d9999ecadd089bc4e319e729ce76b.tar.gz |
Only ignore sigpipe in interactive mode
This allows shell pipes to correctly end redis-cli.
Ref #2066
-rw-r--r-- | src/redis-cli.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index a3caf6b5a..fc1265c3f 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1915,8 +1915,6 @@ 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); @@ -1965,6 +1963,9 @@ int main(int argc, char **argv) { /* Start interactive mode when no command is provided */ if (argc == 0 && !config.eval) { + /* Ignore SIGPIPE in interactive mode to force a reconnect */ + signal(SIGPIPE, SIG_IGN); + /* Note that in repl mode we don't abort on connection error. * A new attempt will be performed for every command send. */ cliConnect(0); |