Add Ctrl + C support

This commit is contained in:
2023-05-20 09:44:13 +08:00
parent fbe7b66e32
commit f0b032e948
3 changed files with 31 additions and 4 deletions

8
signal_handler.ts Normal file
View File

@@ -0,0 +1,8 @@
import { TaskManager } from "./task_manager.ts";
export function add_exit_handler(m: TaskManager) {
const handler = () => {
m.close();
};
Deno.addSignalListener("SIGINT", handler);
}