From 98946cd62a8c80479c5d7e393cec65e7197c22a6 Mon Sep 17 00:00:00 2001 From: Ruben Nogueira <40404708+rubnogueira@users.noreply.github.com> Date: Tue, 19 May 2026 22:02:02 +0100 Subject: [PATCH] fix(install): make tar extraction work on Windows (v7.2.1) Same fix as gifsicle-bin and optipng-bin's matching commits. bsdtar on Windows interprets `C:\...` as a `host:path` remote spec; use `cwd: VENDOR_DIR` + `path.basename(...)` so the tar arg never contains a colon. Bump to 7.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 0e4a820..9c6ef91 100644 --- a/lib/install.js +++ b/lib/install.js @@ -62,7 +62,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 99c042f..4e3a295 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jpegtran-bin", - "version": "7.2.0", + "version": "7.2.1", "description": "jpegtran (part of libjpeg-turbo) wrapper that makes it seamlessly available as a local dependency", "license": "MIT", "repository": "PruvoNet/jpegtran-bin",