fix: fix for version === ""

This commit is contained in:
Amin Yahyaabadi 2021-09-16 07:15:17 -05:00
parent 7f9c5687d2
commit 9702fd9926
5 changed files with 7 additions and 4 deletions

View File

@ -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. The package will be usable from any environment (locally, GitHub Actions, etc). Stay tuned for the stable release.
# Features (WIP) # Features (WIP)
- setup cmake - setup cmake
- setup ninja - setup ninja
- setup llvm - setup llvm

View File

@ -13,7 +13,7 @@ export async function setupAptPack(name: string, version?: string, updateReposit
didUpdate = true 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) { if (exit !== 0) {
throw new Error(`Failed to install ${name} ${version}`) throw new Error(`Failed to install ${name} ${version}`)

View File

@ -13,5 +13,7 @@ export function setupBrewPack(name: string, version?: string) {
} }
// brew is not thread-safe // 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",
})
} }

View File

@ -13,7 +13,7 @@ export async function setupChocoPack(name: string, version?: string, args: strin
} }
let exit let exit
if (version === undefined) { if (version !== undefined && version !== "") {
exit = await exec("choco", ["install", "-y", name, ...args]) exit = await exec("choco", ["install", "-y", name, ...args])
} else { } else {
exit = await exec("choco", ["install", "-y", name, `--version=${version}`, ...args]) exit = await exec("choco", ["install", "-y", name, `--version=${version}`, ...args])

View File

@ -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) { if (exit !== 0) {
throw new Error(`Failed to install ${name} ${version}`) throw new Error(`Failed to install ${name} ${version}`)
} }