fix(build): use explicit Windows System32 tar path (#308)

The previous PowerShell fix still found Git Bash's /usr/bin/tar which
interprets D: as a remote host. Using the explicit path to Windows'
built-in bsdtar (C:\Windows\System32\tar.exe) avoids this issue.

Windows Server 2019+ (GitHub Actions) has bsdtar in System32.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Andy
2025-12-26 14:36:20 +01:00
committed by GitHub
parent 086429cb49
commit c0a02a453d
+7 -9
View File
@@ -257,16 +257,14 @@ function extractTarGz(archivePath, destDir) {
const isWindows = os.platform() === 'win32';
// On Windows, use PowerShell to extract tar.gz (most reliable cross-platform)
// This avoids all the path escaping issues with tar command
// On Windows, use Windows' built-in bsdtar (not Git Bash tar which has path issues)
// Git Bash's /usr/bin/tar interprets D: as a remote host, causing extraction to fail
// Windows Server 2019+ and Windows 10+ have bsdtar at C:\Windows\System32\tar.exe
if (isWindows) {
// PowerShell can extract tar.gz natively on Windows 10+
const psCommand = `
$ErrorActionPreference = 'Stop'
tar -xzf "${archivePath}" -C "${destDir}"
`;
// Use explicit path to Windows tar to avoid Git Bash's /usr/bin/tar
const windowsTar = 'C:\\Windows\\System32\\tar.exe';
const result = spawnSync('powershell', ['-NoProfile', '-Command', psCommand], {
const result = spawnSync(windowsTar, ['-xzf', archivePath, '-C', destDir], {
stdio: 'inherit',
});
@@ -275,7 +273,7 @@ function extractTarGz(archivePath, destDir) {
}
if (result.status !== 0) {
throw new Error(`Failed to extract archive: PowerShell exited with code ${result.status}`);
throw new Error(`Failed to extract archive: Windows tar exited with code ${result.status}`);
}
} else {
// Unix: use tar directly