Skip to content

Commit

Permalink
Install: log possible error when removing vendor dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Apr 19, 2023
1 parent 391018a commit d08baa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion install/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`));
Expand Down
3 changes: 1 addition & 2 deletions lib/libvips.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit d08baa2

Please sign in to comment.