()
| 252 | } |
| 253 | |
| 254 | async disconnect(): Promise<void> { |
| 255 | if (!this.connected) { |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | const child = this.process; |
| 260 | this.process = null; |
| 261 | |
| 262 | try { |
| 263 | child?.stdin.end(); |
| 264 | if (child) { |
| 265 | await killProcessByChildProcess(child); |
| 266 | } |
| 267 | } catch (error) { |
| 268 | logger.debug('[CodexAppServer] Error while stopping process', error); |
| 269 | } finally { |
| 270 | this.rejectAllPending(new Error('Codex app-server disconnected')); |
| 271 | this.connected = false; |
| 272 | this.resetParserState(); |
| 273 | } |
| 274 | |
| 275 | logger.debug('[CodexAppServer] Disconnected'); |
| 276 | } |
| 277 | |
| 278 | private async sendRequest( |
| 279 | method: string, |
no test coverage detected