From d08baa20e6c1f617e1aea413805b7657abeaaf51 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Wed, 19 Apr 2023 11:06:16 +0100 Subject: [PATCH] Install: log possible error when removing vendor dir --- install/libvips.js | 6 +++++- lib/libvips.js | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/install/libvips.js b/install/libvips.js index dfec78e2a..0e40b274a 100644 --- a/install/libvips.js +++ b/install/libvips.js @@ -77,7 +77,11 @@ const verifyIntegrity = function (platformAndArch) { flush: function (done) { const digest = `sha512-${hash.digest('base64')}`; if (expected !== digest) { - libvips.removeVendoredLibvips(); + try { + libvips.removeVendoredLibvips(); + } catch (err) { + libvips.log(err.message); + } libvips.log(`Integrity expected: ${expected}`); libvips.log(`Integrity received: ${digest}`); done(new Error(`Integrity check failed for ${platformAndArch}`)); diff --git a/lib/libvips.js b/lib/libvips.js index 003c93176..ca001d953 100644 --- a/lib/libvips.js +++ b/lib/libvips.js @@ -88,8 +88,7 @@ const hasVendoredLibvips = function () { /* istanbul ignore next */ const removeVendoredLibvips = function () { - const rm = fs.rmSync ? fs.rmSync : fs.rmdirSync; - rm(vendorPath, { recursive: true, maxRetries: 3, force: true }); + fs.rmSync(vendorPath, { recursive: true, maxRetries: 3, force: true }); }; /* istanbul ignore next */