mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge branch 'master' into runtime-api
This commit is contained in:
commit
06abe63fb1
@ -38,6 +38,8 @@ function init(runtime) {
|
||||
log = runtime.log;
|
||||
}
|
||||
|
||||
var activePromise = Promise.resolve();
|
||||
|
||||
function checkModulePath(folder) {
|
||||
var moduleName;
|
||||
var err;
|
||||
@ -73,8 +75,9 @@ function checkExistingModule(module,version) {
|
||||
return false;
|
||||
}
|
||||
function installModule(module,version) {
|
||||
activePromise = activePromise.then(() => {
|
||||
//TODO: ensure module is 'safe'
|
||||
return new Promise(function(resolve,reject) {
|
||||
return new Promise((resolve,reject) => {
|
||||
var installName = module;
|
||||
var isUpgrade = false;
|
||||
try {
|
||||
@ -146,6 +149,12 @@ function installModule(module,version) {
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(err => {
|
||||
// In case of error, reset activePromise to be resolvable
|
||||
activePromise = Promise.resolve();
|
||||
throw err;
|
||||
});
|
||||
return activePromise;
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +187,8 @@ function reportRemovedModules(removedNodes) {
|
||||
}
|
||||
|
||||
function uninstallModule(module) {
|
||||
return new Promise(function(resolve,reject) {
|
||||
activePromise = activePromise.then(() => {
|
||||
return new Promise((resolve,reject) => {
|
||||
if (/[\s;]/.test(module)) {
|
||||
reject(new Error(log._("server.install.invalid")));
|
||||
return;
|
||||
@ -218,6 +228,12 @@ function uninstallModule(module) {
|
||||
}
|
||||
);
|
||||
});
|
||||
}).catch(err => {
|
||||
// In case of error, reset activePromise to be resolvable
|
||||
activePromise = Promise.resolve();
|
||||
throw err;
|
||||
});
|
||||
return activePromise;
|
||||
}
|
||||
|
||||
function checkPrereq() {
|
||||
@ -230,7 +246,7 @@ function checkPrereq() {
|
||||
paletteEditorEnabled = false;
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
child_process.execFile(npmCommand,['-v'],function(err) {
|
||||
if (err) {
|
||||
log.info(log._("server.palette-editor.npm-not-found"));
|
||||
|
Loading…
Reference in New Issue
Block a user