Fixed server self-update
Ylian Saint-Hilaire committed
Jul 18, 2019 at 13:30 UTC
89bfce1dc66e5f025c58668a66af1739e51a33c6
2 files changed
+7
-12
meshcentral.js
+6
-11
@@ -176,21 +176,16 @@ function CreateMeshCentralServer(config, args) {
176
process.exit(); // User CTRL-C exit.
177
} else if (childProcess.xrestart == 3) {
178
// Server self-update exit
179
- var updateArgs = [];
180
- var npmpath = ((typeof obj.args.npmpath == 'string') ? obj.args.npmpath : 'npm');
181
- if (typeof obj.args.npmproxy == 'string') { updateArgs.push('--proxy', obj.args.npmproxy); }
182
- updateArgs.push('install', 'meshcentral');
183
- if (typeof obj.args.selfupdate == 'string') { updateArgs.push('@' + obj.args.selfupdate); }
184
-
179
+ var version = '';
180
+ if (typeof obj.args.selfupdate == 'string') { version = '@' + obj.args.selfupdate; }
181
var child_process = require('child_process');
186
- var xxprocess = child_process.execFile(npmpath, updateArgs, { maxBuffer: Infinity, cwd: obj.parentpath }, function (error, stdout, stderr) { });
182
+ var npmpath = ((typeof obj.args.npmpath == 'string') ? obj.args.npmpath : 'npm');
183
+ var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : '');
184
+ var xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath }, function (error, stdout, stderr) { });
185
xxprocess.data = '';
186
xxprocess.stdout.on('data', function (data) { xxprocess.data += data; });
187
xxprocess.stderr.on('data', function (data) { xxprocess.data += data; });
190
- xxprocess.on('close', function (code) {
191
- console.log('Update completed...');
192
- setTimeout(function () { obj.launchChildServer(startArgs); }, 1000);
193
- });
188
+ xxprocess.on('close', function (code) { console.log('Update completed...'); setTimeout(function () { obj.launchChildServer(startArgs); }, 1000); });
189
} else {
190
if (error != null) {
191
// This is an un-expected restart
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.3.8-b",
3
+ "version": "0.3.8-d",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",