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.
# Features (WIP)
- setup cmake
- setup ninja
- setup llvm

View File

@ -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}`)

View File

@ -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",
})
}

View File

@ -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])

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) {
throw new Error(`Failed to install ${name} ${version}`)
}