From 08676f6775557c81339c32c4f07d513becb43fe1 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 7 Nov 2022 14:41:50 +1300 Subject: [PATCH] Use system defined target file Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 669debe..c3baa2a 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ async function downloadRelease(octokit, os, org, repo, release, token) { const tempdir = os === "windows" ? process.env.TEMP + "\\" : "/tmp/"; const binpath = os === "windows" ? "C:\\Program Files\\GoTestTools\\bin\\" : "/usr/local/bin/"; const extract = os === "windows" ? "tar -xvf" : "tar -xvzf"; + const binfile = os === "windows" ? "gotestfmt.exe" : "gotestfmt"; const archive = `${tempdir}gotestfmt${postfix}`; if (os === "windows") { @@ -40,7 +41,7 @@ async function downloadRelease(octokit, os, org, repo, release, token) { // Extract the archive into the install target console.log("Unpacking archive file...") execSync(`${extract} "${archive}"`) - fs.rename("gotestfmt", `${binpath}/gotestfmt`, function (err) { + fs.rename(binfile, `${binpath}/{binfile}`, function (err) { if (err) { throw err; }