(name, candidates)
| 352 | } |
| 353 | |
| 354 | function resolveBinary(name, candidates) { |
| 355 | const explicitPath = findExistingPath(candidates); |
| 356 | if (explicitPath) { |
| 357 | return explicitPath; |
| 358 | } |
| 359 | |
| 360 | const whichResult = spawnSync('bash', ['-lc', `command -v ${name}`], { |
| 361 | encoding: 'utf8', |
| 362 | }); |
| 363 | if (whichResult.status === 0) { |
| 364 | const resolved = whichResult.stdout.trim(); |
| 365 | if (resolved) { |
| 366 | return resolved; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | return null; |
| 371 | } |
| 372 | |
| 373 | function findExistingPath(candidates) { |
| 374 | for (const candidate of candidates) { |
no test coverage detected