From cdf9fb24be9ffdc9f0bf465a920ed072ffe4e069 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 3 Apr 2022 20:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=8E=B7=E5=8F=96=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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index e1f8f70f..50b8e56c 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -196,8 +196,8 @@ export default class CronService { } const err = await this.killTask(doc.command); const absolutePath = path.resolve(config.logPath, `${doc.log_path}`); - const logFileExist = await fileExist(absolutePath); - if (doc.log_path && logFileExist) { + const logFileExist = doc.log_path && (await fileExist(absolutePath)); + if (logFileExist) { const str = err ? `\n${err}` : ''; fs.appendFileSync( `${absolutePath}`, @@ -328,7 +328,7 @@ export default class CronService { } const absolutePath = path.resolve(config.logPath, `${doc.log_path}`); - const logFileExist = await fileExist(absolutePath); + const logFileExist = doc.log_path && (await fileExist(absolutePath)); if (logFileExist) { return getFileContentByName(`${absolutePath}`); }