diff --git a/src/command_line.cc b/src/command_line.cc index 5e34ddf4..9cacad12 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -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"; diff --git a/src/messages/exit.cc b/src/messages/exit.cc new file mode 100644 index 00000000..c597c8b1 --- /dev/null +++ b/src/messages/exit.cc @@ -0,0 +1,13 @@ +#include "message_handler.h" + +#include + +struct ExitHandler : MessageHandler { + IpcId GetId() const override { return IpcId::Exit; } + + void Run(std::unique_ptr request) override { + LOG_S(INFO) << "Exiting; got IpcId::Exit"; + exit(0); + } +}; +REGISTER_MESSAGE_HANDLER(ExitHandler);