()
| 48 | } |
| 49 | |
| 50 | function _readLedger() { |
| 51 | try { |
| 52 | const p = _ledgerPath(); |
| 53 | if (!fs.existsSync(p)) return _emptyLedger(); |
| 54 | const raw = fs.readFileSync(p, 'utf8'); |
| 55 | const parsed = JSON.parse(raw); |
| 56 | if (!parsed || typeof parsed !== 'object' || !parsed.spawned) return _emptyLedger(); |
| 57 | return parsed; |
| 58 | } catch (_) { |
| 59 | return _emptyLedger(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | function _writeLedger(ledger) { |
| 64 | try { |
no test coverage detected