修复定时任务 task_after 命令无法停止

This commit is contained in:
whyour
2023-10-12 00:45:49 +08:00
parent 99f6073c8e
commit b6376ed2e8
4 changed files with 15 additions and 11 deletions
+3 -3
View File
@@ -423,11 +423,11 @@ export function psTree(pid: number): Promise<number[]> {
export async function killTask(pid: number) {
const pids = await psTree(pid);
// SIGINT 2 程序终止(interrupt)信号,不会打印额外信息
if (pids.length) {
try {
[pid, ...pids].forEach((x) => {
process.kill(x, 2);
[pid, ...pids].reverse().forEach((x) => {
process.kill(x, 15);
});
} catch (error) { }
} else {