Skip to content

Commit

Permalink
Fix gnutar check on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Phantsure authored Nov 7, 2022
1 parent 9366237 commit 0c58e41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/cache/src/internal/cacheUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ export function getCacheFileName(compressionMethod: CompressionMethod): string {
}

export async function isGnuTarInstalled(): Promise<boolean> {
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<T>(name: string, value?: T): T {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/internal/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0c58e41

Please sign in to comment.