From 4942b4346b5a0b2358583b0672b5ee9a133eac67 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 18 Jan 2024 14:34:05 +0300 Subject: [PATCH] Print log before dumping stack trace to avoid log overwriting by other threads. --- telegram-bot-api/telegram-bot-api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram-bot-api/telegram-bot-api.cpp b/telegram-bot-api/telegram-bot-api.cpp index 04273fa..c1b5c92 100644 --- a/telegram-bot-api/telegram-bot-api.cpp +++ b/telegram-bot-api/telegram-bot-api.cpp @@ -103,6 +103,7 @@ static void dump_stacktrace_signal_handler(int sig) { static void fail_signal_handler(int sig) { has_failed = true; + print_log(); { td::LogGuard log_guard; td::signal_safe_write_signal_number(sig); @@ -110,7 +111,6 @@ static void fail_signal_handler(int sig) { options.use_gdb = true; td::Stacktrace::print_to_stderr(options); } - print_log(); _Exit(EXIT_FAILURE); }