Skip to content

Commit b36e97f

Browse files
authored
Use tar tool for .tar.gz (#1050)
1 parent a783d8a commit b36e97f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

node/buildutils.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const getExternalsAsync = async () => {
5151
downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe'),
5252
downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib')
5353
]);
54-
54+
5555
var nodeDirectory = path.join(testPath, 'node');
5656
mkdir('-p', nodeDirectory);
5757
cp(nodeExePath, path.join(nodeDirectory, 'node.exe'));
@@ -118,7 +118,7 @@ var downloadArchiveAsync = async function (url, fileName) {
118118
if (test('-f', marker)) {
119119
return targetPath;
120120
}
121-
121+
122122
// download the archive
123123
var archivePath = await downloadFileAsync(url, scrubbedUrl);
124124
console.log('Extracting archive: ' + url);
@@ -130,8 +130,16 @@ var downloadArchiveAsync = async function (url, fileName) {
130130

131131
// extract
132132
mkdir('-p', targetPath);
133-
var zip = new admZip(archivePath);
134-
zip.extractAllTo(targetPath);
133+
134+
if (targetPath.endsWith('.zip')) {
135+
var zip = new admZip(archivePath);
136+
zip.extractAllTo(targetPath);
137+
}
138+
else if (targetPath.endsWith('.tar.gz')) {
139+
run(`tar --extract --gzip --file="${archivePath}" --directory="${targetPath}"`);
140+
} else {
141+
throw new Error('Unsupported archive type: ' + targetPath);
142+
}
135143

136144
// write the completed marker
137145
fs.writeFileSync(marker, '');

0 commit comments

Comments
 (0)