mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-25 00:16:06 +08:00
修改杀死进程逻辑
This commit is contained in:
parent
f71b3d0378
commit
f0f2c6b537
|
@ -226,15 +226,18 @@ export default class CronService {
|
||||||
const killLogs = [];
|
const killLogs = [];
|
||||||
if (pids && pids.length > 0) {
|
if (pids && pids.length > 0) {
|
||||||
// node 执行脚本时还会有10个子进程,但是ps -ef中不存在,所以截取前三个
|
// node 执行脚本时还会有10个子进程,但是ps -ef中不存在,所以截取前三个
|
||||||
pids = pids.slice(0, 3);
|
|
||||||
for (const id of pids) {
|
for (const id of pids) {
|
||||||
const c = `kill -9 ${id.slice(1)}`;
|
const c = `kill -9 ${id.slice(1)}`;
|
||||||
const { stdout, stderr } = await execAsync(c);
|
try {
|
||||||
if (stderr) {
|
const { stdout, stderr } = await execAsync(c);
|
||||||
killLogs.push(stderr);
|
if (stderr) {
|
||||||
}
|
killLogs.push(stderr);
|
||||||
if (stdout) {
|
}
|
||||||
killLogs.push(stdout);
|
if (stdout) {
|
||||||
|
killLogs.push(stdout);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
killLogs.push(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user