diff --git a/back/config/util.ts b/back/config/util.ts index a0ed8161..d943bdbe 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -469,11 +469,15 @@ export function psTree(pid: number): Promise { export async function killTask(pid: number) { const pids = await psTree(pid); - // SIGALRM 14 时钟信号 + // SIGINT 2 程序终止(interrupt)信号,不会打印额外信息 if (pids.length) { - process.kill(pids[0], 14); + try { + [pid, ...pids].forEach((x) => { + process.kill(x, 2); + }); + } catch (error) {} } else { - process.kill(pid, 14); + process.kill(pid, 2); } } diff --git a/shell/task.sh b/shell/task.sh index a2703f70..de4e7f4d 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -74,7 +74,7 @@ format_params() { fi timeoutCmd="" 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 # params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g') }