修复获取定时任务参数

This commit is contained in:
whyour
2026-06-13 00:09:31 +08:00
parent d1dfde3ca9
commit 7d8feadc78
4 changed files with 8 additions and 10 deletions
+5 -7
View File
@@ -42,13 +42,11 @@ export default class SshKeyService {
key: string,
): Promise<void> {
try {
await writeFileWithLock(
path.join(this.sshPath, alias),
`${key}${os.EOL}`,
{
mode: '400',
},
);
const filePath = path.join(this.sshPath, alias);
try {
await rmPath(filePath);
} catch { }
await writeFileWithLock(filePath, `${key}${os.EOL}`, { mode: '400' });
} catch (error) {
this.logger.error('生成私钥文件失败', error);
}