(config: ConfigFile)
| 428 | } |
| 429 | |
| 430 | private writeConfig(config: ConfigFile): void { |
| 431 | const temp = `${this.configPath}.${process.pid}.${randomUUID()}.tmp`; |
| 432 | try { |
| 433 | fs.mkdirSync(this.dir, { recursive: true, mode: 0o700 }); |
| 434 | // Readers must see either complete choice, never a truncated JSON file. |
| 435 | fs.writeFileSync(temp, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 }); |
| 436 | fs.renameSync(temp, this.configPath); |
| 437 | this.configCache = config; |
| 438 | } catch { |
| 439 | /* fail silent */ |
| 440 | } finally { |
| 441 | try { fs.rmSync(temp, { force: true }); } catch { /* fail silent */ } |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * Default-on consent is gated by a one-time stderr notice (interactive |
no test coverage detected