fixing issue with plugins trying to load 0 plugins and crashing

v1.18.x
Julian Lam 12 years ago
parent 5ed7c31278
commit 7cbe429be9

@ -18,17 +18,19 @@ var fs = require('fs'),
RDB.smembers('plugins:active', next); RDB.smembers('plugins:active', next);
}, },
function(plugins, next) { function(plugins, next) {
async.each(plugins, function(plugin) { if (plugins.length > 0) {
// TODO: Update this check to also check node_modules async.each(plugins, function(plugin) {
var pluginPath = path.join(__dirname, '../plugins/', plugin), // TODO: Update this check to also check node_modules
modulePath = path.join(__dirname, '../node_modules/', plugin); var pluginPath = path.join(__dirname, '../plugins/', plugin),
if (fs.existsSync(pluginPath)) _self.loadPlugin(pluginPath, next); modulePath = path.join(__dirname, '../node_modules/', plugin);
else if (fs.existsSync(modulePath)) _self.loadPlugin(modulePath, next); if (fs.existsSync(pluginPath)) _self.loadPlugin(pluginPath, next);
else { else if (fs.existsSync(modulePath)) _self.loadPlugin(modulePath, next);
if (global.env === 'development') winston.info('[plugins] Plugin \'' + plugin + '\' not found'); else {
next(); // Ignore this plugin silently if (global.env === 'development') winston.info('[plugins] Plugin \'' + plugin + '\' not found');
} next(); // Ignore this plugin silently
}, next); }
}, next);
} else next();
} }
], function(err) { ], function(err) {
if (err) { if (err) {

Loading…
Cancel
Save