From fbad538db2cf3054e283fb7e952ea062035cec7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 03:40:48 +0000 Subject: [PATCH] Fix: Only pass log_name to shell when it has a value Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- back/services/cron.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/back/services/cron.ts b/back/services/cron.ts index f1870ee7..1fa8e6c0 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -509,11 +509,7 @@ export default class CronService { const uniqPath = log_name === '/dev/null' ? await getUniqPath(command, `${id}`) - : log_name || (await getUniqPath(command, `${id}`)); - - // Update cron.log_name with the calculated uniqPath to avoid passing null to shell - cron.log_name = uniqPath; - + : log_name; const logTime = dayjs().format('YYYY-MM-DD-HH-mm-ss-SSS'); const logDirPath = path.resolve(config.logPath, `${uniqPath}`); await fs.mkdir(logDirPath, { recursive: true }); @@ -645,7 +641,12 @@ export default class CronService { if (!command.startsWith(TASK_PREFIX) && !command.startsWith(QL_PREFIX)) { command = `${TASK_PREFIX}${tab.command}`; } - let commandVariable = `real_time=${Boolean(realTime)} log_name=${tab.log_name} no_tee=true ID=${tab.id} `; + let commandVariable = `real_time=${Boolean(realTime)} `; + // Only include log_name if it has a value, shell will handle empty case automatically + if (tab.log_name) { + commandVariable += `log_name=${tab.log_name} `; + } + commandVariable += `no_tee=true ID=${tab.id} `; if (tab.task_before) { commandVariable += `task_before='${tab.task_before .replace(/'/g, "'\\''")