From 57de2d5de254854ca7e01c1a7616cf98d3004323 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 27 Jul 2022 13:39:15 -0700 Subject: [PATCH] fix: use the returned binDir from extractFunction --- src/utils/setup/setupBin.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/setup/setupBin.ts b/src/utils/setup/setupBin.ts index 362b181e..26903dea 100644 --- a/src/utils/setup/setupBin.ts +++ b/src/utils/setup/setupBin.ts @@ -82,8 +82,8 @@ export async function setupBin( } } - const installDir = join(setupDir, extractedFolderName) - const binDir = join(installDir, binRelativeDir) + let installDir = join(setupDir, extractedFolderName) + let binDir = join(installDir, binRelativeDir) const binFile = join(binDir, binFileName) // download ane extract the package into the installation directory. @@ -113,7 +113,11 @@ export async function setupBin( try { const downloaded = await downloadTool(url) - await extractFunction?.(downloaded, setupDir) + const extractedBinDir = await extractFunction?.(downloaded, setupDir) + if (typeof extractedBinDir === "string") { + binDir = extractedBinDir + installDir = extractedBinDir + } } catch (err) { throw new Error(`Failed to download ${name} ${version} ${arch} from ${url}: ${err}`) }