mirror of https://github.com/aminya/setup-cpp
fix: fix llvm extraction on windows
This commit is contained in:
parent
5be5e74675
commit
096cd4150c
|
@ -1,4 +1,5 @@
|
|||
import * as core from "@actions/core"
|
||||
import { exec } from "@actions/exec"
|
||||
import * as tc from "@actions/tool-cache"
|
||||
import * as path from "path"
|
||||
import semverLte from "semver/functions/lte"
|
||||
|
@ -271,7 +272,13 @@ async function getLLVMPackageInfo(version: string, platform: NodeJS.Platform): P
|
|||
binRelativeDir: "bin",
|
||||
extractFunction:
|
||||
platform === "win32"
|
||||
? tc.extractZip
|
||||
? async (file: string, dest: string) => {
|
||||
const exit = await exec("7z", ["x", file, `-o${dest}`])
|
||||
if (exit !== 0) {
|
||||
throw new Error(`Failed to extract ${file} to ${dest} with 7z`)
|
||||
}
|
||||
return dest
|
||||
}
|
||||
: (file: string, dest: string) => {
|
||||
return tc.extractTar(file, dest, "--strip-components=1")
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ export type PackageInfo = {
|
|||
binRelativeDir: string
|
||||
/** The function to extract the downloaded archive. It can be `undefined`, if the binary itself is downloaded directly. */
|
||||
extractFunction?: {
|
||||
(file: string, dest: string): Promise<string>
|
||||
(file: string, dest: string): Promise<string> | Promise<void>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue