mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复停止任务无效
This commit is contained in:
parent
6e5d89c197
commit
b29a9e012c
|
@ -469,11 +469,15 @@ export function psTree(pid: number): Promise<number[]> {
|
||||||
|
|
||||||
export async function killTask(pid: number) {
|
export async function killTask(pid: number) {
|
||||||
const pids = await psTree(pid);
|
const pids = await psTree(pid);
|
||||||
// SIGALRM 14 时钟信号
|
// SIGINT 2 程序终止(interrupt)信号,不会打印额外信息
|
||||||
if (pids.length) {
|
if (pids.length) {
|
||||||
process.kill(pids[0], 14);
|
try {
|
||||||
|
[pid, ...pids].forEach((x) => {
|
||||||
|
process.kill(x, 2);
|
||||||
|
});
|
||||||
|
} catch (error) {}
|
||||||
} else {
|
} else {
|
||||||
process.kill(pid, 14);
|
process.kill(pid, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ format_params() {
|
||||||
fi
|
fi
|
||||||
timeoutCmd=""
|
timeoutCmd=""
|
||||||
if type timeout &>/dev/null; then
|
if type timeout &>/dev/null; then
|
||||||
timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time "
|
timeoutCmd="timeout --foreground -s 2 -k 10s $command_timeout_time "
|
||||||
fi
|
fi
|
||||||
# params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
|
# params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user