| 370 | |
| 371 | const coordinator: McpLifecycleCoordinator = { |
| 372 | attachProcessHandlers(): void { |
| 373 | if (handlersAttached) { |
| 374 | return; |
| 375 | } |
| 376 | handlersAttached = true; |
| 377 | |
| 378 | processRef.once('SIGTERM', handleSigterm); |
| 379 | processRef.once('SIGINT', handleSigint); |
| 380 | processRef.stdin.once('end', handleStdinEnd); |
| 381 | processRef.stdin.once('close', handleStdinClose); |
| 382 | processRef.stdout?.once('error', handleStdoutError); |
| 383 | processRef.stderr?.once('error', handleStderrError); |
| 384 | processRef.once('uncaughtException', handleUncaughtException); |
| 385 | processRef.once('unhandledRejection', handleUnhandledRejection); |
| 386 | processRef.once('exit', handleExit); |
| 387 | }, |
| 388 | |
| 389 | detachProcessHandlers(): void { |
| 390 | if (!handlersAttached) { |