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