mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复创建脚本可能失败
This commit is contained in:
@@ -116,7 +116,9 @@ export default async () => {
|
||||
`Neither content nor source specified for ${item.target}`,
|
||||
);
|
||||
}
|
||||
const content = item.content || (await fs.readFile(item.source!));
|
||||
const content =
|
||||
item.content ||
|
||||
(await fs.readFile(item.source!, { encoding: 'utf-8' }));
|
||||
await writeFileWithLock(item.target, content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +560,10 @@ export default class CronService {
|
||||
if (logFileExist) {
|
||||
return await getFileContentByName(`${absolutePath}`);
|
||||
} else {
|
||||
return '任务未运行';
|
||||
return typeof doc.status === 'number' &&
|
||||
[CrontabStatus.queued, CrontabStatus.running].includes(doc.status)
|
||||
? '运行中...'
|
||||
: '任务空闲中';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ function getUniqueLockPath(filePath: string) {
|
||||
|
||||
export async function writeFileWithLock(
|
||||
filePath: string,
|
||||
content: string | Buffer,
|
||||
content: string,
|
||||
options: Parameters<typeof writeFile>[2] = {},
|
||||
) {
|
||||
if (typeof options === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user