From db3517fe3b63c59c4ab7857d6aa7658b15b99eaa Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Wed, 16 Nov 2022 20:21:40 +0000 Subject: [PATCH] bsd + zstd fallback implementation --- packages/cache/src/internal/tar.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cache/src/internal/tar.ts b/packages/cache/src/internal/tar.ts index 22dd05bf..f077dc52 100644 --- a/packages/cache/src/internal/tar.ts +++ b/packages/cache/src/internal/tar.ts @@ -54,7 +54,7 @@ function getWorkingDirectory(): string { } // Common function for extractTar and listTar to get the compression method -async function getCompressionProgram(compressionMethod: CompressionMethod): string[] { +async function getCompressionProgram(compressionMethod: CompressionMethod): Promise { // -d: Decompress. // unzstd is equivalent to 'zstd -d' // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. @@ -90,7 +90,7 @@ export async function listTar( ): Promise { const args = [ '-tf', - ...getCompressionProgram(compressionMethod), + ...(await getCompressionProgram(compressionMethod)), archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P' ] @@ -106,7 +106,7 @@ export async function extractTar( await io.mkdirP(workingDirectory) const args = [ '-xf', - ...getCompressionProgram(compressionMethod), + ...(await getCompressionProgram(compressionMethod)), archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', @@ -134,7 +134,7 @@ export async function createTar( // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. // Using 30 here because we also support 32-bit self-hosted runners. // Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd. - async function getCompressionProgram(): string[] { + async function getCompressionProgram(): Promise { const tarPath = await getTarPath([]) const BSD_TAR_ZSTD = IS_WINDOWS && tarPath === SystemTarPathOnWindows switch (compressionMethod) { @@ -168,7 +168,7 @@ export async function createTar( workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '--files-from', manifestFilename, - ...getCompressionProgram(), + ...(await getCompressionProgram()), cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), ]