prevent runcommand with --reply from terminating other ws connections (#6797)
Jakub Maruszczak committed
Feb 20, 2025 at 23:09 UTC
0ab3f01ca6cec40484ce829689ee21f871a384d4
2 files changed
+2
-1
agents/meshcore.js
+1
-1
@@ -1579,7 +1579,7 @@ function handleServerCommand(data) {
1579
mesh.cmdchild = require('child_process').execFile('/bin/sh', ['sh'], options);
1580
mesh.cmdchild.descriptorMetadata = 'UserCommandsShell';
1581
mesh.cmdchild.stdout.on('data', function (c) { replydata += c.toString(); });
1582
- mesh.cmdchild.stderr.on('data', function (c) { replydata + c.toString(); });
1582
+ mesh.cmdchild.stderr.on('data', function (c) { replydata += c.toString(); });
1583
mesh.cmdchild.stdin.write(data.cmds.split('\r').join('') + '\nexit\n');
1584
mesh.cmdchild.on('exit', function () {
1585
if (data.reply) {
meshctrl.js
+1
@@ -2243,6 +2243,7 @@ function serverConnect() {
2243
case 'removeDeviceShare':
2244
case 'userbroadcast': { // BROADCAST
2245
if ((settings.cmd == 'shell') || (settings.cmd == 'upload') || (settings.cmd == 'download')) return;
2246
+ if ((data.type == 'runcommands') && (settings.cmd != 'runcommand')) return;
2247
if ((settings.multiresponse != null) && (settings.multiresponse > 1)) { settings.multiresponse--; break; }
2248
if (data.responseid == 'meshctrl') {
2249
if (data.meshid) { console.log(data.result, data.meshid); }