Adds SIGPIPE to ignored exceptions(unix)

This commit is contained in:
RipleyTom 2020-11-11 22:59:30 +01:00 committed by Ivan
parent 3888b0429c
commit 1378645413

View file

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