fix: honor underscore-unused convention and make durability fsyncs cross-platform
- eslint: respect the repo's existing _-prefix convention for unused vars - phase-one-blockers: derive projectRoot via import.meta.dirname so Windows checkouts stop producing C:\C:\... paths - backup/release-evidence/cutover-orchestrator: skip POSIX-only directory fsync on win32 and fsync read-only handles through a writable handle
This commit is contained in:
@@ -159,7 +159,8 @@ async function digestFileHandle(handle: FileHandle): Promise<string> {
|
||||
}
|
||||
|
||||
async function syncFile(path: string): Promise<void> {
|
||||
const handle = await open(path, 'r');
|
||||
// Windows FlushFileBuffers requires a writable handle; POSIX allows fsync on 'r'.
|
||||
const handle = await open(path, process.platform === 'win32' ? 'r+' : 'r');
|
||||
try {
|
||||
await handle.sync();
|
||||
} finally {
|
||||
@@ -168,6 +169,7 @@ async function syncFile(path: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function syncDirectory(path: string): Promise<void> {
|
||||
if (process.platform === 'win32') return; // directory fsync only exists on POSIX
|
||||
const handle = await open(path, 'r');
|
||||
try {
|
||||
await handle.sync();
|
||||
|
||||
Reference in New Issue
Block a user