* Start hub as a child process (will exit when CLI exits)
()
| 125 | * Start hub as a child process (will exit when CLI exits) |
| 126 | */ |
| 127 | function startServerAsChild(): void { |
| 128 | const serverProcess = spawnHappyCLI(['hub'], { |
| 129 | detached: false, |
| 130 | stdio: 'ignore', |
| 131 | env: process.env |
| 132 | }) |
| 133 | |
| 134 | logger.debug(`[AUTO-START] Hub process spawned with PID ${serverProcess.pid}`) |
| 135 | |
| 136 | // Ensure hub is killed when CLI exits |
| 137 | process.on('exit', () => { |
| 138 | serverProcess.kill() |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Main entry point: auto-start hub if conditions are met |
no test coverage detected