Print log before dumping stack trace to avoid log overwriting by other threads.

This commit is contained in:
levlam 2024-01-18 14:34:05 +03:00
parent fc1de34374
commit 4942b4346b

View File

@ -103,6 +103,7 @@ static void dump_stacktrace_signal_handler(int sig) {
static void fail_signal_handler(int sig) { static void fail_signal_handler(int sig) {
has_failed = true; has_failed = true;
print_log();
{ {
td::LogGuard log_guard; td::LogGuard log_guard;
td::signal_safe_write_signal_number(sig); td::signal_safe_write_signal_number(sig);
@ -110,7 +111,6 @@ static void fail_signal_handler(int sig) {
options.use_gdb = true; options.use_gdb = true;
td::Stacktrace::print_to_stderr(options); td::Stacktrace::print_to_stderr(options);
} }
print_log();
_Exit(EXIT_FAILURE); _Exit(EXIT_FAILURE);
} }