#include "DisableCrashReporter.hpp" #ifndef _MSC_VER #include #include static void crash_handler(int sig) { _exit(1); } #else #include #include #include static int exception_handler(LPEXCEPTION_POINTERS) { _exit(1); } static int runtime_check_handler(int, const char*, int, const char*, const char*, ...) { _exit(1); } #endif void disableCrashReporter() { #ifndef _MSC_VER struct sigaction sa; sa.sa_handler = &crash_handler; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGABRT, &sa, NULL); sigaction(SIGBUS, &sa, NULL); #else SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)&exception_handler); _RTC_SetErrorFunc(&runtime_check_handler); #endif } void exitImmediately() { disableCrashReporter(); _exit(0); }