From d473d33d9f6603452dfe8f5addc20b2108f11fa7 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Mon, 30 Sep 2019 09:51:01 +0200 Subject: [PATCH] tool-cache: Use --force-local for tar on Windows to correctly deal with paths --- packages/tool-cache/src/tool-cache.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/tool-cache/src/tool-cache.ts b/packages/tool-cache/src/tool-cache.ts index 9ab2deb5ae..a482e0952f 100644 --- a/packages/tool-cache/src/tool-cache.ts +++ b/packages/tool-cache/src/tool-cache.ts @@ -201,7 +201,13 @@ export async function extractTar( dest = dest || (await _createExtractFolder(dest)) const tarPath: string = await io.which('tar', true) - await exec(`"${tarPath}"`, [flags, '-C', dest, '-f', file]) + const args: string[] = [flags] + if (IS_WINDOWS) { + // On Windows, absolute path use a ':' (e.g. C:\foo), which is incorrectly recognized as a remote path by tar unless this flag is passed + args.push('--force-local') + } + args.push('-C', dest, '-f', file) + await exec(`"${tarPath}"`, args) return dest }