( fullPath: string, entry: Record<string, unknown>, )
| 2609 | */ |
| 2610 | /* eslint-disable custom-rules/no-sync-fs -- sync callers (exit cleanup, materialize) */ |
| 2611 | function appendEntryToFile( |
| 2612 | fullPath: string, |
| 2613 | entry: Record<string, unknown>, |
| 2614 | ): void { |
| 2615 | const fs = getFsImplementation() |
| 2616 | const line = jsonStringify(entry) + '\n' |
| 2617 | try { |
| 2618 | fs.appendFileSync(fullPath, line, { mode: 0o600 }) |
| 2619 | } catch { |
| 2620 | fs.mkdirSync(dirname(fullPath), { mode: 0o700 }) |
| 2621 | fs.appendFileSync(fullPath, line, { mode: 0o600 }) |
| 2622 | } |
| 2623 | } |
| 2624 | |
| 2625 | /** |
| 2626 | * Sync tail read for reAppendSessionMetadata's external-writer check. |
no test coverage detected