From 32334145920c6ef2d51f5d19704018e4937f8dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Marc=C3=A8=20i=20Igual?= Date: Mon, 3 Apr 2023 13:36:18 +0200 Subject: [PATCH] :bug: Fix wrong binary with multiple options (#920) --- src/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 16b781c99..b2b77dac7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1048,9 +1048,11 @@ export async function isBinInPath( result.toString() === "" || result.toString().indexOf("Could not find files") < 0 ) { - return binaryName.localeCompare(result.toString().trim()) === 0 + // Sometimes multiple paths can be returned. They are separated by new lines, get only the first one + const selectedResult = result.toString().split("\n")[0].trim(); + return binaryName.localeCompare(selectedResult) === 0 ? "" - : result.toString().trim(); + : selectedResult; } } catch (error) { Logger.error(`Cannot access filePath: ${binaryName}`, error);