From c3517ccc41c97129a1e664ca7c474e37430a7309 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Wed, 11 Aug 2021 16:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E4=BB=BB=E5=8A=A1=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/cron.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index 16f94507..7273d666 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -207,11 +207,20 @@ export default class CronService { return; } const pids = pid.match(/\d+/g); + const killLogs = []; + this.logger.info(`需要杀死的进程:${JSON.stringify(pids.toString())}`); for (const id of pids) { const c = `kill -9 ${id}`; const { stdout, stderr } = await execAsync(c); - return stderr; + if (stderr) { + killLogs.push(stderr); + } + if (stdout) { + killLogs.push(stdout); + } } + this.logger.info(`杀死的进程结果:${JSON.stringify(killLogs)}`); + return JSON.stringify(killLogs); } catch (e) { return JSON.stringify(e); }