Fixed meshcore.js, this.root._dispatcher.close(); missing on older agents.

Ylian Saint-Hilaire committed Aug 27, 2022 at 15:47 UTC a3d66b60fc5142590d3ae3894cc9f2f1e50a97fb
1 file changed +6 -6
agents/meshcore.js
+6 -6
@@ -1339,7 +1339,7 @@ function handleServerCommand(data) {
1339 }
1340 });
1341 } else {
1342 - require("clipboard").read().then(function (str) {
1342 + require('clipboard').read().then(function (str) {
1343 if (str) {
1344 MeshServerLogEx(21, [str.length], "Getting clipboard content, " + str.length + " byte(s)", data);
1345 mesh.SendCommand({ action: 'msg', type: 'getclip', sessionid: data.sessionid, data: str, tag: data.tag });
@@ -1372,7 +1372,7 @@ function handleServerCommand(data) {
1372 this._c.root = this.parent;
1373 this._c.on('end', function ()
1374 {
1375 - this.root._dispatcher.close();
1375 + try { this.root._dispatcher.close(); } catch (ex) { }
1376 this.root._dispatcher = null;
1377 this.root = null;
1378 mesh.SendCommand({ action: 'msg', type: 'setclip', sessionid: data.sessionid, success: true });
@@ -1381,7 +1381,7 @@ function handleServerCommand(data) {
1381 }
1382 }
1383 else {
1384 - require("clipboard")(data.data);
1384 + require('clipboard')(data.data);
1385 mesh.SendCommand({ action: 'msg', type: 'setclip', sessionid: data.sessionid, success: true });
1386 } // Set the clipboard
1387 }
@@ -4322,7 +4322,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
4322 if (require('MeshAgent').isService) {
4323 require('clipboard').dispatchRead().then(function (str) { sendConsoleText(str, sessionid); });
4324 } else {
4325 - require("clipboard").read().then(function (str) { sendConsoleText(str, sessionid); });
4325 + require('clipboard').read().then(function (str) { sendConsoleText(str, sessionid); });
4326 }
4327 break;
4328 case 'setclip': {
@@ -4348,7 +4348,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
4348 this._c.root = this.parent;
4349 this._c.on('end', function ()
4350 {
4351 - this.root._dispatcher.close();
4351 + try { this.root._dispatcher.close(); } catch (ex) { }
4352 this.root._dispatcher = null;
4353 this.root = null;
4354 });
@@ -4357,7 +4357,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
4357 response = 'Setting clipboard to: "' + args['_'][0] + '"';
4358 }
4359 else {
4360 - require("clipboard")(args['_'][0]); response = 'Setting clipboard to: "' + args['_'][0] + '"';
4360 + require('clipboard')(args['_'][0]); response = 'Setting clipboard to: "' + args['_'][0] + '"';
4361 }
4362 }
4363 break;