( dir: string, pointer: BridgePointer, )
| 60 | * itself cause a crash. Logs and swallows on error. |
| 61 | */ |
| 62 | export async function writeBridgePointer( |
| 63 | dir: string, |
| 64 | pointer: BridgePointer, |
| 65 | ): Promise<void> { |
| 66 | const path = getBridgePointerPath(dir) |
| 67 | try { |
| 68 | await mkdir(dirname(path), { recursive: true }) |
| 69 | await writeFile(path, jsonStringify(pointer), 'utf8') |
| 70 | logForDebugging(`[bridge:pointer] wrote ${path}`) |
| 71 | } catch (err: unknown) { |
| 72 | logForDebugging(`[bridge:pointer] write failed: ${err}`, { level: 'warn' }) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Read the pointer and its age (ms since last write). Operates directly |
no test coverage detected