Skip to content

Commit

Permalink
修复任务命令带有 -m 参数时,日志目录生成异常
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Sep 29, 2024
1 parent 418695c commit 3f71f9a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions back/config/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,18 @@ export async function getUniqPath(
command: string,
id: string,
): Promise<string> {
let suffix = '';
if (/^\d+$/.test(id)) {
id = `_${id}`;
} else {
id = '';
suffix = `_${id}`;
}

let items = command.split(/ +/);

const maxTimeCommandIndex = items.findIndex((x) => x === '-m');
if (maxTimeCommandIndex !== -1) {
items = items.slice(maxTimeCommandIndex + 2);
}

const items = command.split(/ +/);
let str = items[0];
if (items[0] === TASK_COMMAND) {
str = items[1];
Expand All @@ -499,7 +504,7 @@ export async function getUniqPath(
str = `${tempStr}_${str.slice(slashIndex + 1)}`;
}

return `${str}${id}`;
return `${str}${suffix}`;
}

export function safeJSONParse(value?: string) {
Expand Down

0 comments on commit 3f71f9a

Please sign in to comment.