Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/fs/locked-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ function createLockOptions(request: LockRequest, lockfilePath: string): LockOpti
retries: request.retries ?? DEFAULT_LOCK_RETRIES,
realpath: false,
lockfilePath,
// Don't crash on ECOMPROMISED — the lock is silently released instead.
// This prevents process crashes under disk I/O pressure.
onCompromised: request.onCompromised ?? (() => {}),
};
if (typeof request.onCompromised === "function") {
options.onCompromised = request.onCompromised;
}
return options;
}

Expand Down Expand Up @@ -108,7 +108,11 @@ export class LockedFileSystem {
return await operation();
} finally {
for (const release of releases.reverse()) {
await release();
try {
await release();
} catch {
/* lock already released (e.g. ECOMPROMISED) */
}
}
}
}
Expand Down