From d60cb9c7af0429ee219ef2bd8fc7028d44f473ed Mon Sep 17 00:00:00 2001 From: Ruben Nogueira <40404708+rubnogueira@users.noreply.github.com> Date: Tue, 19 May 2026 22:01:51 +0100 Subject: [PATCH] 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) --- lib/install.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/install.js b/lib/install.js index 29d0bbe..6730f2a 100644 --- a/lib/install.js +++ b/lib/install.js @@ -59,7 +59,11 @@ async function downloadPrebuilt() { const tempPath = path.join(VENDOR_DIR, `_dl.${process.pid}.tgz`); try { await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(tempPath)); - const tar = spawnSync('tar', ['-xzf', tempPath, '-C', VENDOR_DIR], {stdio: 'inherit'}); + // Pass tar a *relative* filename via cwd, not an absolute path. + // Windows' bsdtar treats `C:\...` as a `host:path` remote spec + // ("Cannot connect to C: resolve failed"); using a basename with + // cwd avoids that ambiguity and works identically on POSIX. + const tar = spawnSync('tar', ['-xzf', path.basename(tempPath)], {cwd: VENDOR_DIR, stdio: 'inherit'}); if (tar.status !== 0) { throw new Error(`tar extraction exited with status ${tar.status}`); } diff --git a/package.json b/package.json index b63defc..6fd3d43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "optipng-bin", - "version": "9.2.0", + "version": "9.2.1", "description": "OptiPNG wrapper that makes it seamlessly available as a local dependency", "license": "MIT", "repository": "PruvoNet/optipng-bin",