Index: lib/Support/Unix/Signals.inc =================================================================== --- lib/Support/Unix/Signals.inc +++ lib/Support/Unix/Signals.inc @@ -203,7 +203,7 @@ // if there is, it's not our direct responsibility. For whatever reason, our // continued execution is no longer desirable. static const int IntSigs[] = { - SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2 + SIGHUP, SIGINT, SIGTERM, SIGUSR1, SIGUSR2 }; // Signals that represent that we have a bug, and our prompt termination has @@ -297,6 +297,7 @@ registerHandler(S); for (auto S : KillSigs) registerHandler(S); + signal(SIGPIPE, SIG_IGN); } static void UnregisterHandlers() { Index: lib/Support/raw_ostream.cpp =================================================================== --- lib/Support/raw_ostream.cpp +++ lib/Support/raw_ostream.cpp @@ -709,6 +709,9 @@ ) continue; + if (errno == EPIPE) + break; + // Otherwise it's a non-recoverable error. Note it and quit. error_detected(std::error_code(errno, std::generic_category())); break;