Avoid probing extra executable candidates (#996)
This commit is contained in:
@@ -126,11 +126,12 @@ export async function findExecutable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const candidates = await enumerateCandidates(trimmed);
|
const candidates = await enumerateCandidates(trimmed);
|
||||||
const probeResults = await Promise.all(
|
for (const candidate of candidates) {
|
||||||
candidates.map((candidate) => probeExecutable(candidate, probeTimeoutMs)),
|
if (await probeExecutable(candidate, probeTimeoutMs)) {
|
||||||
);
|
return candidate;
|
||||||
const firstMatch = probeResults.findIndex((result) => result);
|
}
|
||||||
return firstMatch === -1 ? null : candidates[firstMatch];
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function isCommandAvailable(command: string): Promise<boolean> {
|
export async function isCommandAvailable(command: string): Promise<boolean> {
|
||||||
|
|||||||
Reference in New Issue
Block a user