1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-14 12:01:52 +00:00

Merge pull request #2524 from nzalev/add-err-checking-npm-install

Added error checking at self update npm install
This commit is contained in:
Ylian Saint-Hilaire 2021-04-18 22:44:01 -07:00 committed by GitHub
commit 05259eb7c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -445,11 +445,16 @@ function CreateMeshCentralServer(config, args) {
var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : '');
var env = Object.assign({}, process.env); // Shallow clone
if (typeof obj.args.npmproxy == 'string') { env['HTTP_PROXY'] = env['HTTPS_PROXY'] = env['http_proxy'] = env['https_proxy'] = obj.args.npmproxy; }
var xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) { });
var xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) {
if ((error != null) && (error != '')) { console.log('Update failed: ' + error); }
});
xxprocess.data = '';
xxprocess.stdout.on('data', function (data) { xxprocess.data += data; });
xxprocess.stderr.on('data', function (data) { xxprocess.data += data; });
xxprocess.on('close', function (code) { console.log('Update completed...'); setTimeout(function () { obj.launchChildServer(startArgs); }, 1000); });
xxprocess.on('close', function (code) {
if (code == 0) { console.log('Update completed...'); }
setTimeout(function () { obj.launchChildServer(startArgs); }, 1000);
});
} else {
if (error != null) {
// This is an un-expected restart