mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-11-19 02:29:26 +01:00
Ignore dump-log and dump-stacktrace signals after crash.
This commit is contained in:
parent
aa05180325
commit
bb8b7a6702
@ -83,11 +83,17 @@ void print_log() {
|
|||||||
td::signal_safe_write("------------------------\n");
|
td::signal_safe_write("------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::atomic_bool has_failed{false};
|
||||||
|
|
||||||
static void dump_stacktrace_signal_handler(int sig) {
|
static void dump_stacktrace_signal_handler(int sig) {
|
||||||
|
if (has_failed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
td::Stacktrace::print_to_stderr();
|
td::Stacktrace::print_to_stderr();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fail_signal_handler(int sig) {
|
static void fail_signal_handler(int sig) {
|
||||||
|
has_failed = true;
|
||||||
td::signal_safe_write_signal_number(sig);
|
td::signal_safe_write_signal_number(sig);
|
||||||
td::Stacktrace::PrintOptions options;
|
td::Stacktrace::PrintOptions options;
|
||||||
options.use_gdb = true;
|
options.use_gdb = true;
|
||||||
@ -105,6 +111,9 @@ static void change_verbosity_level_signal_handler(int sig) {
|
|||||||
static std::atomic_flag need_dump_log;
|
static std::atomic_flag need_dump_log;
|
||||||
|
|
||||||
static void dump_log_signal_handler(int sig) {
|
static void dump_log_signal_handler(int sig) {
|
||||||
|
if (has_failed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
need_dump_log.clear();
|
need_dump_log.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user