Skip to content

Commit 65253a4

Browse files
authored
Merge pull request #2 from PruvoNet/fix/windows-tar-extraction
fix(install): make tar extraction work on Windows (v7.2.1)
2 parents 5baff80 + 98946cd commit 65253a4

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/install.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ async function downloadPrebuilt() {
6262
const tempPath = path.join(VENDOR_DIR, `_dl.${process.pid}.tgz`);
6363
try {
6464
await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(tempPath));
65-
const tar = spawnSync('tar', ['-xzf', tempPath, '-C', VENDOR_DIR], {stdio: 'inherit'});
65+
// Pass tar a *relative* filename via cwd, not an absolute path.
66+
// Windows' bsdtar treats `C:\...` as a `host:path` remote spec
67+
// ("Cannot connect to C: resolve failed"); using a basename with
68+
// cwd avoids that ambiguity and works identically on POSIX.
69+
const tar = spawnSync('tar', ['-xzf', path.basename(tempPath)], {cwd: VENDOR_DIR, stdio: 'inherit'});
6670
if (tar.status !== 0) {
6771
throw new Error(`tar extraction exited with status ${tar.status}`);
6872
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jpegtran-bin",
3-
"version": "7.2.0",
3+
"version": "7.2.1",
44
"description": "jpegtran (part of libjpeg-turbo) wrapper that makes it seamlessly available as a local dependency",
55
"license": "MIT",
66
"repository": "PruvoNet/jpegtran-bin",

0 commit comments

Comments
 (0)