diff --git a/lib/API/Modules/Modularizer.js b/lib/API/Modules/Modularizer.js index 73cdf558..5b795259 100644 --- a/lib/API/Modules/Modularizer.js +++ b/lib/API/Modules/Modularizer.js @@ -169,15 +169,15 @@ function installModule(CLI, module_name, opts, cb) { Common.printError(e); } - Common.extend(opts, { + opts = Common.extend(opts, { cmd : cmd, development_mode : development_mode, proc_path : proc_path }); Configuration.set(MODULE_CONF_PREFIX + ':' + canonic_module_name, { - uid : opts.uid || null, - gid : opts.gid || null + uid : opts.uid, + gid : opts.gid }, function(err, data) { startModule(CLI, opts, function(err, dt) { diff --git a/lib/Common.js b/lib/Common.js index 62aeab44..7f43e07b 100644 --- a/lib/Common.js +++ b/lib/Common.js @@ -445,8 +445,13 @@ Common.printOut = function() { /** * Raw extend */ -Common.extend = function(destination, source){ - if (!source || typeof source != 'object') return destination; +Common.extend = function(destination, source) { + if (typeof destination !== 'object') { + destination = {}; + } + if (!source || typeof source !== 'object') { + return destination; + } Object.keys(source).forEach(function(new_key) { if (source[new_key] != '[object Object]')