Skip to content

Commit 97e92e2

Browse files
committed
fix: catch the fallback errors directly
1 parent 31b061a commit 97e92e2

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

dist/legacy/setup-cpp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.mjs

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

+1-1
Large diffs are not rendered by default.

src/llvm/llvm.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ async function llvmBinaryDeps_(_majorVersion: number) {
9999
for (const dep of ["libtinfo5", "libtinfo6"]) {
100100
/* eslint-disable no-await-in-loop */
101101
try {
102+
await installAptPack([{ name: dep }])
103+
} catch (_err) {
102104
try {
103-
await installAptPack([{ name: dep }])
104-
} catch (err) {
105105
if (dep === "libtinfo5") {
106106
// Manually install libtinfo5 if the package is not available
107-
info(`Failed to install ${dep} ${err}\nManually installing the package`)
107+
info(`Failed to install ${dep}\nManually installing the package`)
108108
const arch = x86_64.includes(process.arch)
109109
? "amd64"
110110
: arm64.includes(process.arch)
@@ -114,16 +114,17 @@ async function llvmBinaryDeps_(_majorVersion: number) {
114114
const fileName = `libtinfo5_6.3-2ubuntu0.1_${arch}.deb`
115115
const url = `http://launchpadlibrarian.net/666971015/${fileName}`
116116
const dl = new DownloaderHelper(url, tmpdir(), { fileName })
117-
dl.on("error", (dlErr) => {
118-
throw new Error(`Failed to download ${url}: ${dlErr}`)
117+
dl.on("error", async (dlErr) => {
118+
info(`Failed to download ${url}: ${dlErr}`)
119+
await dl.stop()
119120
})
120121
await dl.start()
121122
// Install the downloaded package via dpkg
122123
execRootSync("dpkg", ["-i", join(tmpdir(), fileName)])
123124
}
125+
} catch (_errFallback) {
126+
info(`Failed to install ${dep}. Ignoring`)
124127
}
125-
} catch (err) {
126-
info(`Failed to install ${dep}. Ignoring`)
127128
}
128129
/* eslint-enable no-await-in-loop */
129130
}

0 commit comments

Comments
 (0)