about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index feca410f4eb7..8f3c0121cf9b 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -82,6 +82,12 @@ static void initAndRun(int argc, char * * argv)
     if (sigaction(SIGINT, &act, &oact))
         throw SysError("installing handler for SIGINT");
 
+    /* Ignore SIGPIPE. */
+    act.sa_handler = SIG_IGN;
+    act.sa_flags = 0;
+    if (sigaction(SIGPIPE, &act, &oact))
+        throw SysError("ignoring SIGPIPE");
+
     /* Process the NIX_LOG_TYPE environment variable. */
     string lt = getEnv("NIX_LOG_TYPE");
     if (lt != "") setLogType(lt);