(child: ChildProcess)
| 129 | } |
| 130 | |
| 131 | async function waitForHubStart(child: ChildProcess): Promise<Socket> { |
| 132 | let foundExistingHub = false |
| 133 | child.once('exit', (code) => { |
| 134 | foundExistingHub = code === HUB_BUSY_EXIT_CODE |
| 135 | }) |
| 136 | |
| 137 | const socket = await connectWithRetry(HUB_STARTUP_TIMEOUT) |
| 138 | if (foundExistingHub) { |
| 139 | log.info('Spawned Hub found an existing lifecycle lock. Using the active Hub.') |
| 140 | } |
| 141 | child.unref() |
| 142 | return socket |
| 143 | } |
| 144 | |
| 145 | async function tryBecomeLeaderAndStartHub(): Promise<Socket> { |
| 146 | let releaseLock: (() => Promise<void>) | undefined |
no test coverage detected