From 9702fd9926119f216328f4e8cc8e26aa09893823 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 16 Sep 2021 07:15:17 -0500 Subject: [PATCH] fix: fix for version === "" --- README.md | 1 + src/utils/setup/setupAptPack.ts | 2 +- src/utils/setup/setupBrewPack.ts | 4 +++- src/utils/setup/setupChocoPack.ts | 2 +- src/utils/setup/setupPipPack.ts | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 11d8b893..503345fb 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This package is designed to be fully **modular** and as **minimal** as possible. The package will be usable from any environment (locally, GitHub Actions, etc). Stay tuned for the stable release. # Features (WIP) + - setup cmake - setup ninja - setup llvm diff --git a/src/utils/setup/setupAptPack.ts b/src/utils/setup/setupAptPack.ts index 060f9bf8..dd03c5db 100644 --- a/src/utils/setup/setupAptPack.ts +++ b/src/utils/setup/setupAptPack.ts @@ -13,7 +13,7 @@ export async function setupAptPack(name: string, version?: string, updateReposit didUpdate = true } - const exit = await exec(apt, ["install", version !== undefined ? `${name}=${version}` : name]) + const exit = await exec(apt, ["install", version !== undefined && version !== "" ? `${name}=${version}` : name]) if (exit !== 0) { throw new Error(`Failed to install ${name} ${version}`) diff --git a/src/utils/setup/setupBrewPack.ts b/src/utils/setup/setupBrewPack.ts index 2ef79292..a9098310 100644 --- a/src/utils/setup/setupBrewPack.ts +++ b/src/utils/setup/setupBrewPack.ts @@ -13,5 +13,7 @@ export function setupBrewPack(name: string, version?: string) { } // brew is not thread-safe - execFileSync("brew", ["install", version !== undefined ? `${name}@${version}` : name], { stdio: "inherit" }) + execFileSync("brew", ["install", version !== undefined && version !== "" ? `${name}@${version}` : name], { + stdio: "inherit", + }) } diff --git a/src/utils/setup/setupChocoPack.ts b/src/utils/setup/setupChocoPack.ts index e0cef6d1..c593e7ea 100644 --- a/src/utils/setup/setupChocoPack.ts +++ b/src/utils/setup/setupChocoPack.ts @@ -13,7 +13,7 @@ export async function setupChocoPack(name: string, version?: string, args: strin } let exit - if (version === undefined) { + if (version !== undefined && version !== "") { exit = await exec("choco", ["install", "-y", name, ...args]) } else { exit = await exec("choco", ["install", "-y", name, `--version=${version}`, ...args]) diff --git a/src/utils/setup/setupPipPack.ts b/src/utils/setup/setupPipPack.ts index 841df6a7..53ab8eb5 100644 --- a/src/utils/setup/setupPipPack.ts +++ b/src/utils/setup/setupPipPack.ts @@ -21,7 +21,7 @@ export async function setupPipPack(name: string, version?: string) { } } - const exit = await exec(pip, ["install", version !== undefined ? `${name}==${version}` : name]) + const exit = await exec(pip, ["install", version !== undefined && version !== "" ? `${name}==${version}` : name]) if (exit !== 0) { throw new Error(`Failed to install ${name} ${version}`) }