()
| 456 | // normal repo pays nothing extra (it connects on the very first probe). |
| 457 | const candidates = getDaemonSocketCandidates(root); |
| 458 | const connectAnyCandidate = async (): Promise<Awaited<ReturnType<typeof connectWithHello>>> => { |
| 459 | for (const candidate of candidates) { |
| 460 | const s = await connectWithHello(candidate); |
| 461 | // A wrong-version daemon IS up — definitive; propagate so the caller |
| 462 | // serves in-process instead of spawning + polling for 6s. Don't keep |
| 463 | // probing fallbacks past it. |
| 464 | if (s === 'version-mismatch') return s; |
| 465 | if (s) return s; |
| 466 | } |
| 467 | return null; |
| 468 | }; |
| 469 | const getDaemonSocket = async () => { |
| 470 | // Fast path: a daemon may already be listening (on either candidate). |
| 471 | const probe = await connectAnyCandidate(); |
nothing calls this directly
no test coverage detected