()
| 177 | type HubToolWithHandler = { |
| 178 | [Name in HubToolMetadata['name']]: HubToolWithHandlerFor<HubToolByName<Name>> |
| 179 | }[HubToolMetadata['name']] |
| 180 | |
| 181 | type SocketProbeResult = 'live' | 'missing' | { staleCode: string } |
| 182 | |
| 183 | function classifySocketProbeError(error: NodeJS.ErrnoException): SocketProbeResult | null { |
| 184 | if (error.code === 'ENOENT') return 'missing' |
| 185 | if (error.code === 'ECONNREFUSED' || error.code === 'ENOTSOCK') { |
| 186 | return { staleCode: error.code } |
| 187 | } |
| 188 | return null |
| 189 | } |
| 190 | |
| 191 | function probeHubSocket(): Promise<SocketProbeResult> { |
| 192 | return new Promise((resolve, reject) => { |
| 193 | let settled = false |
no test coverage detected