From cc0f0aa809d911bcda4f2ca75f2b450d5e0a462d Mon Sep 17 00:00:00 2001 From: vmarchaud Date: Mon, 21 Aug 2017 14:00:39 +0200 Subject: [PATCH] bugfix: fixes #3096 --- lib/API/Modules/Modularizer.js | 6 +++--- lib/Common.js | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) 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]')