From 03a0cec60e410f678993ac2c18b442e1aa1222cd Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 22 Apr 2021 00:17:51 +0200 Subject: [PATCH] Don't write shutdown crashes --- server/src/SignalHandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/SignalHandler.cpp b/server/src/SignalHandler.cpp index 59572f2..145bf34 100644 --- a/server/src/SignalHandler.cpp +++ b/server/src/SignalHandler.cpp @@ -42,13 +42,17 @@ extern bool mainThreadDone; #ifdef BREAKPAD_EXCEPTION_HANDLER static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) { 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; } logCritical(LOG_GENERAL, "The server crashed!"); 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)); + } auto path = fs::u8path(descriptor.path()); path = fs::u8path(ts::config::crash_path + "crash_dump_" + path.filename().string());