(flag: string, version?: string)
| 274 | } |
| 275 | |
| 276 | private async resolveVersionObj(flag: string, version?: string) { |
| 277 | const installed = await this.rawServiceVersions(flag) |
| 278 | if (!installed.length) { |
| 279 | throw new Error(`No installed version for ${flag}`) |
| 280 | } |
| 281 | if (version) { |
| 282 | const exact = installed.find((item) => item?.version === version) |
| 283 | if (!exact) { |
| 284 | throw new Error(`Version ${version} of ${flag} not found`) |
| 285 | } |
| 286 | return exact |
| 287 | } |
| 288 | const status = ServiceProcessManager.statusOf(flag) |
| 289 | if (status.instances.length > 0) { |
| 290 | const running = installed.find((item) => |
| 291 | status.instances.some((instance) => instance.bin === item.bin) |
| 292 | ) |
| 293 | if (running) { |
| 294 | return running |
| 295 | } |
| 296 | } |
| 297 | return installed.find((item) => item?.enable) ?? installed[0] |
| 298 | } |
| 299 | |
| 300 | private async listConfigFiles(flag: string, version?: SoftInstalled) { |
| 301 | const list = await callFork(this.forkManager, flag, 'listConfigFiles', version) |
no test coverage detected