(config: ConfigFile)
| 574 | } |
| 575 | |
| 576 | private writeConfig(config: ConfigFile): void { |
| 577 | const temp = `${this.configPath}.${process.pid}.${randomUUID()}.tmp`; |
| 578 | try { |
| 579 | fs.mkdirSync(this.dir, { recursive: true, mode: 0o700 }); |
| 580 | // Readers must see either complete choice, never a truncated JSON file. |
| 581 | fs.writeFileSync(temp, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 }); |
| 582 | fs.renameSync(temp, this.configPath); |
| 583 | this.configCache = config; |
| 584 | } catch { |
| 585 | /* fail silent */ |
| 586 | } finally { |
| 587 | try { fs.rmSync(temp, { force: true }); } catch { /* fail silent */ } |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | /** |
| 592 | * Default-on consent is gated by a one-time stderr notice (interactive |
no test coverage detected