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; }();