Skip to content

Commit a1edde3

Browse files
committed
Correctly handle tar.exe on Windows to use System32 one if available
1 parent 3585498 commit a1edde3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/core/zip.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ export function unzip(file: string, dir?: string) {
4040
}
4141
} else {
4242
// use the tar command to untar this
43+
// On Windows, prefer System32 tar to avoid Git Bash tar path issues
44+
let tarCmd = "tar";
45+
if (isWindows) {
46+
const systemRoot = Deno.env.get("SystemRoot") || "C:\\Windows";
47+
const system32Tar = `${systemRoot}\\System32\\tar.exe`;
48+
if (existsSync(system32Tar)) {
49+
tarCmd = system32Tar;
50+
}
51+
// Otherwise fall back to "tar" in PATH
52+
}
4353
return execProcess(
44-
{ cmd: "tar", args: ["xfz", file], cwd: dir, stdout: "piped" },
54+
{ cmd: tarCmd, args: ["xfz", file], cwd: dir, stdout: "piped" },
4555
);
4656
}
4757
}

0 commit comments

Comments
 (0)