refactor: cleanly shutdown project manager and tree walker on early exit

This commit is contained in:
CJ van den Berg 2024-03-27 22:13:03 +01:00
parent c36cd87119
commit 20e9327ac7
2 changed files with 51 additions and 25 deletions

View file

@ -3,6 +3,7 @@ const nc = @import("notcurses");
const tp = @import("thespian");
const log = @import("log");
const config = @import("config");
const project_manager = @import("project_manager");
const build_options = @import("build_options");
const root = @import("root");
@ -223,6 +224,10 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) tp.result {
return command.executeName(cmd, ctx) catch |e| self.logger.err(cmd, e);
}
if (try m.match(.{"quit"})) {
project_manager.shutdown();
return tp.exit_normal();
}
if (try m.match(.{ "project_manager", "shutdown" })) {
return tp.exit_normal();
}