Experiment with asking tar to figure out the decompression method

This commit is contained in:
Henry Mercer 2024-08-13 12:41:15 +01:00
parent b43ac1c23f
commit e2572269a1
3 changed files with 16 additions and 3 deletions

View file

@ -526,7 +526,7 @@ export const downloadCodeQL = async function (
logger.debug("Extracting CodeQL bundle.");
const extractionStart = performance.now();
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
const extractedBundlePath = await extractBundle(archivedBundlePath);
const extractionDurationMs = Math.round(performance.now() - extractionStart);
logger.debug(
`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`,
@ -705,3 +705,10 @@ async function cleanUpGlob(glob: string, name: string, logger: Logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}
async function extractBundle(archivedBundlePath: string): Promise<string> {
if (archivedBundlePath.endsWith(".tar.gz")) {
return await toolcache.extractTar(archivedBundlePath);
}
return await toolcache.extractTar(archivedBundlePath, undefined, "x");
}