Fixed unlink() required callback in NodeJS v10.
Ylian Saint-Hilaire committed
Jan 6, 2019 at 20:32 UTC
d1e3eda1f138bd184e517a8263796926383521a1
4 files changed
+4
-10
meshcentral.js
-6
@@ -580,12 +580,6 @@ function CreateMeshCentralServer(config, args) {
580
if (restoreFile) {
581
obj.debug(1, 'Server stopped, updating settings: ' + restoreFile);
582
console.log('Updating settings folder...');
583
- /*
584
- var unzip = require('unzip');
585
- var rs = obj.fs.createReadStream(restoreFile);
586
- rs.on('end', () => { setTimeout(function () { fs.unlinkSync(restoreFile); process.exit(123); }, 500); });
587
- rs.pipe(unzip.Extract({ path: obj.datapath }));
588
- */
583
584
var yauzl = require("yauzl");
585
yauzl.open(restoreFile, { lazyEntries: true }, function (err, zipfile) {
meshuser.js
+2
-2
@@ -384,7 +384,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
384
for (i in command.names) {
385
var s = obj.path.join(scpath, command.names[i]), d = obj.path.join(path, command.names[i]);
386
sendUpdate = false;
387
- copyFile(s, d, function (op) { if (op != null) { obj.fs.unlink(op, function () { obj.parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { obj.parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
387
+ copyFile(s, d, function (op) { if (op != null) { obj.fs.unlink(op, function (err) { obj.parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { obj.parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
388
}
389
}
390
@@ -724,7 +724,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
724
{
725
// Clear the server error log
726
if ((user.siteadmin & 16) == 0) break;
727
- obj.parent.parent.fs.unlink(obj.parent.parent.getConfigFilePath('mesherrors.txt'));
727
+ obj.parent.parent.fs.unlink(obj.parent.parent.getConfigFilePath('mesherrors.txt'), function (err) { });
728
break;
729
}
730
case 'createmesh':
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.2.5-v",
3
+ "version": "0.2.5-w",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
webserver.js
+1
-1
@@ -1125,7 +1125,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1125
obj.parent.DispatchEvent([user._id], obj, 'updatefiles'); // Fire an event causing this user to update this files
1126
});
1127
} else {
1128
- try { obj.fs.unlink(file.path); } catch (e) { }
1128
+ try { obj.fs.unlink(file.path, function (err) { }); } catch (e) { }
1129
}
1130
}
1131
}