( fullPath: string, entry: Record<string, unknown>, )
| 2570 | */ |
| 2571 | /* eslint-disable custom-rules/no-sync-fs -- sync callers (exit cleanup, materialize) */ |
| 2572 | function appendEntryToFile( |
| 2573 | fullPath: string, |
| 2574 | entry: Record<string, unknown>, |
| 2575 | ): void { |
| 2576 | const fs = getFsImplementation() |
| 2577 | const line = jsonStringify(entry) + '\n' |
| 2578 | try { |
| 2579 | fs.appendFileSync(fullPath, line, { mode: 0o600 }) |
| 2580 | } catch { |
| 2581 | fs.mkdirSync(dirname(fullPath), { mode: 0o700 }) |
| 2582 | fs.appendFileSync(fullPath, line, { mode: 0o600 }) |
| 2583 | } |
| 2584 | } |
| 2585 | |
| 2586 | /** |
| 2587 | * Sync tail read for reAppendSessionMetadata's external-writer check. |
no test coverage detected