Skip to content

Commit d60cb9c

Browse files
rubnogueiraclaude
andcommitted
fix(install): make tar extraction work on Windows (v9.2.1)
Same fix as gifsicle-bin's matching commit. Windows bsdtar treats `C:\...` as a `host:path` remote spec and bails with "Cannot connect to C: resolve failed". Move to `cwd: VENDOR_DIR` + `path.basename(...)` so the argument never contains a colon. Identical behavior on POSIX. Bump to 9.2.1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7eb6df6 commit d60cb9c

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
@@ -59,7 +59,11 @@ async function downloadPrebuilt() {
5959
const tempPath = path.join(VENDOR_DIR, `_dl.${process.pid}.tgz`);
6060
try {
6161
await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(tempPath));
62-
const tar = spawnSync('tar', ['-xzf', tempPath, '-C', VENDOR_DIR], {stdio: 'inherit'});
62+
// Pass tar a *relative* filename via cwd, not an absolute path.
63+
// Windows' bsdtar treats `C:\...` as a `host:path` remote spec
64+
// ("Cannot connect to C: resolve failed"); using a basename with
65+
// cwd avoids that ambiguity and works identically on POSIX.
66+
const tar = spawnSync('tar', ['-xzf', path.basename(tempPath)], {cwd: VENDOR_DIR, stdio: 'inherit'});
6367
if (tar.status !== 0) {
6468
throw new Error(`tar extraction exited with status ${tar.status}`);
6569
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "optipng-bin",
3-
"version": "9.2.0",
3+
"version": "9.2.1",
44
"description": "OptiPNG wrapper that makes it seamlessly available as a local dependency",
55
"license": "MIT",
66
"repository": "PruvoNet/optipng-bin",

0 commit comments

Comments
 (0)