rec:服务端终止恢复终端颜色。

This commit is contained in:
taynpg 2025-04-16 22:55:46 +08:00
parent 9839fa79ea
commit 733c5a68a3
3 changed files with 99 additions and 2 deletions

90
.vscode/settings.json vendored
View File

@ -40,6 +40,94 @@
"files.associations": { "files.associations": {
".clang-tidy": "yaml", ".clang-tidy": "yaml",
"filesystem": "cpp", "filesystem": "cpp",
"regex": "cpp" "regex": "cpp",
"functional": "cpp",
"algorithm": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"expected": "cpp",
"resumable": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"source_location": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"variant": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
} }
} }

@ -1 +1 @@
Subproject commit eed787c1bfc1ed1585843923673e27354be7c0bd Subproject commit 5ec78141817eef68f92a89b19ea5675f8b5b559b

View File

@ -25,6 +25,14 @@ namespace fs = std::filesystem;
#include <crashelper.h> #include <crashelper.h>
#endif #endif
void signal_handler(int signal)
{
if (signal == SIGINT) {
fc_recovery_color();
exit(signal);
}
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if defined(GRAB_CRASH) #if defined(GRAB_CRASH)
@ -33,6 +41,7 @@ int main(int argc, char* argv[])
backward::SetDumpFileSavePath(err); backward::SetDumpFileSavePath(err);
backward::SetDumpLogSavePath(err); backward::SetDumpLogSavePath(err);
CRASHELPER_MARK_ENTRY(); CRASHELPER_MARK_ENTRY();
sh.register_user_sig_handler([](int sig) { signal_handler(sig); });
#endif #endif
#ifdef _WIN32 #ifdef _WIN32