From 1378645413c291ad18e5d18b6d919b366507f9d8 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Wed, 11 Nov 2020 22:59:30 +0100 Subject: [PATCH] Adds SIGPIPE to ignored exceptions(unix) --- Utilities/Thread.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 9ea38b6733..c93860db66 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1789,6 +1789,10 @@ static void signal_handler(int sig, siginfo_t* info, void* uct) noexcept report_fatal_error(msg); } +void sigpipe_signaling_handler(int) +{ +} + const bool s_exception_handler_set = []() -> bool { struct ::sigaction sa; @@ -1802,6 +1806,13 @@ const bool s_exception_handler_set = []() -> bool std::abort(); } + sa.sa_handler = sigpipe_signaling_handler; + if (::sigaction(SIGPIPE, &sa, NULL) == -1) + { + std::fprintf(stderr, "sigaction(SIGPIPE) failed (%d).\n", errno); + std::abort(); + } + std::printf("Debugger: %d\n", +IsDebuggerPresent()); return true; }();