From 0c58e4113e697b8be21607b6a70f4de3dc9106c3 Mon Sep 17 00:00:00 2001 From: Sampark Sharma Date: Mon, 7 Nov 2022 13:43:54 +0000 Subject: [PATCH] Fix gnutar check on windows --- packages/cache/src/internal/cacheUtils.ts | 3 ++- packages/cache/src/internal/tar.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index c2ace526..4dd3a614 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -117,8 +117,9 @@ export function getCacheFileName(compressionMethod: CompressionMethod): string { } export async function isGnuTarInstalled(): Promise { + const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe` const versionOutput = await getVersion('tar') - return versionOutput.toLowerCase().includes('gnu tar') + return versionOutput.toLowerCase().includes('gnu tar') || fs.existsSync(gnuTar) } export function assertDefined(name: string, value?: T): T { diff --git a/packages/cache/src/internal/tar.ts b/packages/cache/src/internal/tar.ts index 3b351414..9d5add77 100644 --- a/packages/cache/src/internal/tar.ts +++ b/packages/cache/src/internal/tar.ts @@ -15,7 +15,7 @@ async function getTarPath( case 'win32': { const systemTar = `${process.env['windir']}\\System32\\tar.exe` const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe` - if (compressionMethod !== CompressionMethod.Gzip && existsSync(gnuTar)) { + if (existsSync(gnuTar)) { args.push('--force-local') return gnuTar } else if (compressionMethod !== CompressionMethod.Gzip) {