( state: DaemonStateData, name = 'remote-control', )
| 27 | * Write daemon state to disk. Called by the supervisor on startup. |
| 28 | */ |
| 29 | export function writeDaemonState( |
| 30 | state: DaemonStateData, |
| 31 | name = 'remote-control', |
| 32 | ): void { |
| 33 | const filePath = getDaemonStateFilePath(name) |
| 34 | mkdirSync(dirname(filePath), { recursive: true }) |
| 35 | writeFileSync(filePath, JSON.stringify(state, null, 2), 'utf-8') |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Read daemon state from disk. Returns null if no state file exists. |
no test coverage detected