[clangd] Flush stderr after signal handlers run, so we always get the full stack/crash info

This commit is contained in:
Sam McCall 2021-10-26 01:08:28 +02:00
parent 413e249a47
commit aa1ac2ae45
1 changed files with 6 additions and 1 deletions

View File

@ -681,7 +681,12 @@ int main(int argc, char *argv[]) {
llvm::InitializeAllTargetInfos();
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::sys::AddSignalHandler(
[](void *) { ThreadCrashReporter::runCrashHandlers(); }, nullptr);
[](void *) {
ThreadCrashReporter::runCrashHandlers();
// Ensure ThreadCrashReporter and PrintStackTrace output is visible.
llvm::errs().flush();
},
nullptr);
llvm::sys::SetInterruptFunction(&requestShutdown);
llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
OS << versionString() << "\n"