From 41a14fe5505a76d4c9ad7ae701e2f5dc511b32fb Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:01:10 -0700 Subject: [PATCH] fix --- lib/clean.js | 6 +++++- lib/util/napi.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/clean.js b/lib/clean.js index da999ee4..64e2a07b 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -23,7 +23,11 @@ function clean(gyp, argv, callback) { exists(to_delete, (found) => { if (found) { if (!gyp.opts.silent_clean) console.log('[' + package_json.name + '] Removing "%s"', to_delete); - fs.rm(to_delete, { recursive: true, force: true }, callback); + try { + fs.rmSync(to_delete, { recursive: true, force: true }); + } catch (err) { + return callback(err); + } } return callback(); }); diff --git a/lib/util/napi.js b/lib/util/napi.js index e5cbc2ec..46fe40dc 100644 --- a/lib/util/napi.js +++ b/lib/util/napi.js @@ -166,14 +166,14 @@ module.exports.get_napi_build_version_from_command_args = function(command_args) module.exports.swap_build_dir_out = function(napi_build_version) { if (napi_build_version) { - fs.rm(module.exports.get_build_dir(napi_build_version), { recursive: true, force: true }); + fs.rmSync(module.exports.get_build_dir(napi_build_version), { recursive: true, force: true }); fs.renameSync('build', module.exports.get_build_dir(napi_build_version)); } }; module.exports.swap_build_dir_in = function(napi_build_version) { if (napi_build_version) { - fs.rm('build', { recursive: true, force: true }); + fs.rmSync('build', { recursive: true, force: true }); fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build'); } };