feat: add task records and verified engineering check jobs
This commit is contained in:
@@ -15,7 +15,12 @@ export class ArtifactStore {
|
||||
const file = path.join(this.root, relative);
|
||||
fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||
if (fs.lstatSync(path.dirname(file)).isSymbolicLink() || fs.existsSync(file) && fs.lstatSync(file).isSymbolicLink()) throw new Error('执行工件不能通过链接写入。');
|
||||
if (!fs.existsSync(file)) {
|
||||
if (fs.existsSync(file)) {
|
||||
const existing = fs.readFileSync(file);
|
||||
if (existing.length !== bytes.length || createHash('sha256').update(existing).digest('hex') !== sha256) {
|
||||
throw new Error('已有执行工件校验失败,实际结果需要核对。');
|
||||
}
|
||||
} else {
|
||||
const temporary = file + '.' + randomUUID() + '.tmp';
|
||||
const handle = fs.openSync(temporary, 'wx', 0o600);
|
||||
try { fs.writeFileSync(handle, bytes); fs.fsyncSync(handle); } finally { fs.closeSync(handle); }
|
||||
|
||||
Reference in New Issue
Block a user