Don't write shutdown crashes

This commit is contained in:
WolverinDEV 2021-04-22 00:17:51 +02:00
parent e99c1b442a
commit 03a0cec60e

View File

@ -42,13 +42,17 @@ extern bool mainThreadDone;
#ifdef BREAKPAD_EXCEPTION_HANDLER #ifdef BREAKPAD_EXCEPTION_HANDLER
static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) { static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) {
if(ts::server::isShuttingDown()) { if(ts::server::isShuttingDown()) {
/* We don't care about this crash dump. Remove it. */
std::error_code error_code{};
fs::remove(fs::u8path(descriptor.path()), error_code);
return true; return true;
} }
logCritical(LOG_GENERAL, "The server crashed!"); logCritical(LOG_GENERAL, "The server crashed!");
try { try {
if(!fs::exists(fs::u8path(ts::config::crash_path))) if(!fs::exists(fs::u8path(ts::config::crash_path))) {
fs::create_directories(fs::u8path(ts::config::crash_path)); fs::create_directories(fs::u8path(ts::config::crash_path));
}
auto path = fs::u8path(descriptor.path()); auto path = fs::u8path(descriptor.path());
path = fs::u8path(ts::config::crash_path + "crash_dump_" + path.filename().string()); path = fs::u8path(ts::config::crash_path + "crash_dump_" + path.filename().string());