Skip to content

Commit 2b5ebd7

Browse files
committed
Fix: On Windows GitHub Actions runners, tar in PATH resolves to Git for Windows' MSYS2 tar
1 parent 6887adc commit 2b5ebd7

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tools/scripts/download-wasm.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import { execSync } from 'child_process';
1313
import fs from 'fs';
1414
import os from 'os';
1515
import path from 'path';
16+
import tarFs from 'tar-fs';
1617
import { fileURLToPath } from 'url';
18+
import { createGunzip } from 'zlib';
1719

1820
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1921
const repoRoot = path.resolve(__dirname, '../../');
@@ -99,11 +101,15 @@ for (const [key, version] of Object.entries(versions)) {
99101
}
100102
const tarball = path.join(tmpDir, tarballs[0]);
101103

102-
// Extract tarball
104+
// Extract tarball (pure Node.js — avoids system tar issues on Windows)
103105
const extractDir = path.join(tmpDir, 'extracted');
104106
fs.mkdirSync(extractDir);
105-
execSync(`tar -xzf "${tarball}" -C "${extractDir}"`, {
106-
stdio: 'pipe',
107+
await new Promise((resolve, reject) => {
108+
fs.createReadStream(tarball)
109+
.pipe(createGunzip())
110+
.pipe(tarFs.extract(extractDir))
111+
.on('finish', resolve)
112+
.on('error', reject);
107113
});
108114

109115
// The tarball contains a "package/" directory

0 commit comments

Comments
 (0)