mirror of https://github.com/aminya/setup-cpp
fix: fix for version === ""
This commit is contained in:
parent
7f9c5687d2
commit
9702fd9926
|
@ -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
|
||||||
|
|
|
@ -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}`)
|
||||||
|
|
|
@ -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",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -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])
|
||||||
|
|
|
@ -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}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue