perf: skip 7z installation if found

This commit is contained in:
Amin Yahyaabadi 2022-02-05 22:05:18 -08:00
parent fc877ac81b
commit 954f03e554
3 changed files with 7 additions and 6 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

@ -9,13 +9,14 @@ let sevenZip: string | undefined
export async function extractExe(file: string, dest: string) {
// install 7z if needed
if (sevenZip === undefined) {
if (which.sync("7z", { nothrow: true }) !== null) {
sevenZip = "7z"
if (which.sync("7z", { nothrow: true }) === null) {
await setupSevenZip("", "", process.arch)
}
await setupSevenZip("", "", process.arch)
// eslint-disable-next-line require-atomic-updates
sevenZip = "7z"
}
await execa("7z", ["x", file, `-o${dest}`])
await execa(sevenZip, ["x", file, `-o${dest}`])
return dest
}