fix(compiler): fsync output directories after unpack to avoid XFS delayed logging causing corrupt or invisible directory entries during subsequent TypeScript emits
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsbuild',
|
||||
version: '4.1.25',
|
||||
version: '4.1.26',
|
||||
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
|
||||
}
|
||||
|
||||
@@ -405,6 +405,20 @@ export class TsCompiler {
|
||||
successfulOutputDirs.push(destDir);
|
||||
}
|
||||
|
||||
// Fsync all output directories to force XFS metadata commit
|
||||
// before the next compilation step. Without this, XFS delayed logging
|
||||
// can cause directory entries from previous compilations to become
|
||||
// invisible or corrupted during subsequent TypeScript emit operations.
|
||||
for (const dir of successfulOutputDirs) {
|
||||
try {
|
||||
const fd = fs.openSync(dir, 'r');
|
||||
fs.fsyncSync(fd);
|
||||
fs.closeSync(fd);
|
||||
} catch {
|
||||
// Directory might not exist yet
|
||||
}
|
||||
}
|
||||
|
||||
// Diagnostic: log all output directory states after each compilation
|
||||
if (!isQuiet && !isJson) {
|
||||
for (const prevDir of successfulOutputDirs) {
|
||||
|
||||
Reference in New Issue
Block a user