Make IpcId::Exit handled as a message.

This commit is contained in:
Jacob Dufault 2017-12-05 00:14:46 -08:00
parent 07c0ae109e
commit 905a4ab2b1
2 changed files with 13 additions and 6 deletions

View File

@ -1250,12 +1250,6 @@ bool QueryDbMainLoop(Config* config,
// FIXME: assert(!message), ie, verify that a handler was run.
switch (message->method_id) {
case IpcId::Exit: {
LOG_S(INFO) << "Exiting; got IpcId::Exit";
exit(0);
break;
}
case IpcId::CqueryFreshenIndex: {
LOG_S(INFO) << "Freshening " << project->entries.size() << " files";

13
src/messages/exit.cc Normal file
View File

@ -0,0 +1,13 @@
#include "message_handler.h"
#include <loguru.hpp>
struct ExitHandler : MessageHandler {
IpcId GetId() const override { return IpcId::Exit; }
void Run(std::unique_ptr<BaseIpcMessage> request) override {
LOG_S(INFO) << "Exiting; got IpcId::Exit";
exit(0);
}
};
REGISTER_MESSAGE_HANDLER(ExitHandler);