Merge pull request #4180 from node-red/4168-make-module-install-synchronous

Ensure external modules are installed synchronously
This commit is contained in:
Nick O'Leary 2023-05-22 14:39:26 +01:00 committed by GitHub
commit b904c23e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 58 additions and 53 deletions

View File

@ -242,7 +242,9 @@ async function ensureModuleDir() {
}
}
let installLock = Promise.resolve()
async function installModule(moduleDetails) {
const result = installLock.then(async () => {
let installSpec = moduleDetails.module;
if (!registryUtil.checkModuleAllowed( moduleDetails.module, moduleDetails.version,installAllowList,installDenyList)) {
const e = new Error("Install not allowed");
@ -299,6 +301,9 @@ async function installModule(moduleDetails) {
throw e;
}
})
})
installLock = result.catch(() => {})
return result
}
module.exports = {