1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-16 15:33:16 +00:00

GC reference update

This commit is contained in:
Bryan Roe
2021-03-13 21:12:36 -08:00
parent 838ae01a92
commit d976b0818a
6 changed files with 152 additions and 134 deletions

View File

@@ -49,6 +49,11 @@ function sendConsoleText(msg)
require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: msg });
}
function stdparser(c)
{
if (this.str == null) { this.str = ''; }
this.str += c.toString();
}
function messageBox()
{
@@ -214,11 +219,12 @@ function linux_messageBox()
}
if (xinfo == null) { return (false); }
var child = require('child_process').execFile('/bin/sh', ['sh'], { uid: uid, env: { XAUTHORITY: xinfo.xauthority ? xinfo.xauthority : "", DISPLAY: xinfo.display } });
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdout.str = ''; child.stdout.on('data', stdparser );
child.stdin.write(location + ' --help-all | grep timeout\nexit\n');
child.stderr.on('data', function (e) { });
child.waitExit();
Object.defineProperty(this, "_timeout", { value: child.stdout.str.trim() == '' ? false : true });
child = null;
return (this._timeout);
}
else
@@ -334,7 +340,7 @@ function linux_messageBox()
value: (function ()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdout.on('data', stdparser);
child.stdin.write("whereis notify-send | awk '{ print $2 }'\nexit\n");
child.waitExit();
return (child.stdout.str.trim() == '' ? null : { path: child.stdout.str.trim() });