(fn: (current: string | undefined) => LockResult<T>)
| 406 | fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8"); |
| 407 | } catch { |
| 408 | // If config.json is unreadable, write a minimal file |
| 409 | const config = { _auth: JSON.parse(authJson) }; |
| 410 | fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8"); |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | withLock<T>(fn: (current: string | undefined) => LockResult<T>): T { |
| 415 | const current = this.readAuthJson(); |
| 416 | const { result, next } = fn(current); |
| 417 | if (next !== undefined) { |
| 418 | this.writeAuthJson(next); |
nothing calls this directly
no test coverage detected