Install: log possible error when removing vendor dir

This commit is contained in:
Lovell Fuller 2023-04-19 11:06:16 +01:00
parent 391018ad3d
commit d08baa20e6
2 changed files with 6 additions and 3 deletions

View File

@ -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}`));

View File

@ -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 */