mirror of https://github.com/actions/toolkit
Fix gnutar check on windows
parent
9366237c90
commit
0c58e4113e
|
@ -117,8 +117,9 @@ export function getCacheFileName(compressionMethod: CompressionMethod): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function isGnuTarInstalled(): Promise<boolean> {
|
export async function isGnuTarInstalled(): Promise<boolean> {
|
||||||
|
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe`
|
||||||
const versionOutput = await getVersion('tar')
|
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 {
|
export function assertDefined<T>(name: string, value?: T): T {
|
||||||
|
|
|
@ -15,7 +15,7 @@ async function getTarPath(
|
||||||
case 'win32': {
|
case 'win32': {
|
||||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`
|
const systemTar = `${process.env['windir']}\\System32\\tar.exe`
|
||||||
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\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')
|
args.push('--force-local')
|
||||||
return gnuTar
|
return gnuTar
|
||||||
} else if (compressionMethod !== CompressionMethod.Gzip) {
|
} else if (compressionMethod !== CompressionMethod.Gzip) {
|
||||||
|
|
Loading…
Reference in New Issue