(state)
| 147 | } |
| 148 | |
| 149 | function writeState(state) { |
| 150 | try { |
| 151 | const dir = getEvolutionDir(); |
| 152 | if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); |
| 153 | fs.writeFileSync(getStatePath(), JSON.stringify(state, null, 2) + '\n'); |
| 154 | } catch (e) { |
| 155 | if (process.env.DEBUG || process.env.EVOLVER_DEBUG) { |
| 156 | try { process.stderr.write('selfPR.writeState failed: ' + String(e && e.message || e) + '\n'); } catch (_) {} |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | function isInCooldown() { |
| 162 | const state = readState(); |
no test coverage detected