fix: skip apt initialization in subsequent calls

This commit is contained in:
Amin Yahyaabadi 2022-02-13 19:36:22 -08:00
parent 252db2e159
commit 69841cf764
3 changed files with 13 additions and 7 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,8 @@ export type InstallationInfo = {
binDir: string binDir: string
} }
let didInit: boolean = false
/** /**
* A function that: * A function that:
* *
@ -83,12 +85,16 @@ export async function setupBin(
if (!existsSync(binDir) || !existsSync(binFile)) { if (!existsSync(binDir) || !existsSync(binFile)) {
info(`Download and extract ${name} ${version}`) info(`Download and extract ${name} ${version}`)
if (!didInit) {
if (process.platform === "linux") { if (process.platform === "linux") {
// extraction dependencies // extraction dependencies
await setupAptPack("unzip") await setupAptPack("unzip")
await setupAptPack("tar") await setupAptPack("tar")
await setupAptPack("xz-utils") await setupAptPack("xz-utils")
} }
// eslint-disable-next-line require-atomic-updates
didInit = true
}
try { try {
const downloaded = await downloadTool(url) const downloaded = await downloadTool(url)