1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added option to auto-clean NPM cache on update. #3225

This commit is contained in:
Ylian Saint-Hilaire 2021-10-28 23:00:42 -07:00
parent 04876bf823
commit 0b38049015
3 changed files with 10 additions and 1 deletions

View file

@ -467,7 +467,15 @@ function CreateMeshCentralServer(config, args) {
xxprocess.stderr.on('data', function (data) { xxprocess.data += data; });
xxprocess.on('close', function (code) {
if (code == 0) { console.log('Update completed...'); }
setTimeout(function () { obj.launchChildServer(startArgs); }, 1000);
if (obj.args.cleannpmcacheonupdate === true) {
// Perform NPM cache clean
console.log('Cleaning NPM cache...');
var xxxprocess = child_process.exec(npmpath + ' cache clean --force', { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) { });
xxxprocess.on('close', function (code) { setTimeout(function () { obj.launchChildServer(startArgs); }, 1000); });
} else {
// Run the updated server
setTimeout(function () { obj.launchChildServer(startArgs); }, 1000);
}
});
} else {
if (error != null) {