( name = 'remote-control', )
| 39 | * Read daemon state from disk. Returns null if no state file exists. |
| 40 | */ |
| 41 | export function readDaemonState( |
| 42 | name = 'remote-control', |
| 43 | ): DaemonStateData | null { |
| 44 | const filePath = getDaemonStateFilePath(name) |
| 45 | try { |
| 46 | const raw = readFileSync(filePath, 'utf-8') |
| 47 | return JSON.parse(raw) as DaemonStateData |
| 48 | } catch { |
| 49 | return null |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Remove the daemon state file. |
no test coverage detected