mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Try to always log when exiting.
This commit is contained in:
parent
6a50c48aaa
commit
0376da015f
@ -1459,7 +1459,7 @@ bool QueryDbMainLoop(Config* config,
|
||||
|
||||
// Make sure cache directory is valid.
|
||||
if (config->cacheDirectory.empty()) {
|
||||
LOG_S(ERROR) << "No cache directory";
|
||||
LOG_S(FATAL) << "Exiting; no cache directory";
|
||||
exit(1);
|
||||
}
|
||||
config->cacheDirectory = NormalizePath(config->cacheDirectory);
|
||||
@ -1596,6 +1596,7 @@ bool QueryDbMainLoop(Config* config,
|
||||
}
|
||||
|
||||
case IpcId::Exit: {
|
||||
LOG_S(INFO) << "Exiting; got IpcId::Exit";
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
@ -2926,7 +2927,7 @@ bool QueryDbMainLoop(Config* config,
|
||||
}
|
||||
|
||||
default: {
|
||||
LOG_S(INFO) << "[querydb] Unhandled IPC message "
|
||||
LOG_S(FATAL) << "Exiting; unhandled IPC message "
|
||||
<< IpcIdToString(message->method_id);
|
||||
exit(1);
|
||||
}
|
||||
@ -2978,8 +2979,10 @@ void RunQueryDbThread(const std::string& bin_name,
|
||||
signature_cache.get());
|
||||
|
||||
// No more work left and exit request. Exit.
|
||||
if (!did_work && exit_when_idle && WorkThread::num_active_threads == 0)
|
||||
if (!did_work && exit_when_idle && WorkThread::num_active_threads == 0) {
|
||||
LOG_S(INFO) << "Exiting; exit_when_idle is set and there is no more work";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Cleanup and free any unused memory.
|
||||
FreeUnusedMemory();
|
||||
@ -3042,6 +3045,7 @@ void LaunchStdinLoop(Config* config,
|
||||
}
|
||||
|
||||
case IpcId::Exit: {
|
||||
LOG_S(INFO) << "Exiting";
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
@ -3087,8 +3091,8 @@ void LaunchStdinLoop(Config* config,
|
||||
}
|
||||
|
||||
default: {
|
||||
std::cerr << "[stdin] Unhandled IPC message "
|
||||
<< IpcIdToString(message->method_id) << std::endl;
|
||||
LOG_S(ERROR) << "Unhandled IPC message "
|
||||
<< IpcIdToString(message->method_id);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -3131,8 +3135,8 @@ void LaunchStdoutThread(std::unordered_map<IpcId, Timer>* request_times,
|
||||
}
|
||||
|
||||
default: {
|
||||
std::cerr << "[stdout] Unhandled IPC message "
|
||||
<< IpcIdToString(message->method_id) << std::endl;
|
||||
LOG_S(FATAL) << "Exiting; unhandled IPC message "
|
||||
<< IpcIdToString(message->method_id);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "platform.h"
|
||||
|
||||
#include <tinydir.h>
|
||||
#include <loguru/loguru.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -333,7 +334,7 @@ void UpdateTestExpectation(const std::string& filename,
|
||||
}
|
||||
|
||||
void Fail(const std::string& message) {
|
||||
std::cerr << "Fatal error: " << message << std::endl;
|
||||
LOG_S(FATAL) << "Fatal error: " << message;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user