Force exit if receive sigterm

This commit is contained in:
2024-01-21 16:17:11 +08:00
parent ee6b7d354f
commit b91bf5928e

View File

@@ -24,7 +24,11 @@ export function add_exit_handler(m: TaskManager) {
};
Deno.addSignalListener("SIGINT", handler);
if (Deno.build.os !== "windows") {
Deno.addSignalListener("SIGTERM", handler);
Deno.addSignalListener("SIGTERM", () => {
m.force_abort();
ExitTarget.dispatchEvent(new Event("close"));
m.close();
});
}
}