1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-16 00:03:45 +00:00

1. Added ability to search env vars by uid

2. updated toaster to work with KDE
This commit is contained in:
Bryan Roe
2019-05-17 22:10:52 -07:00
parent bbe2098b7e
commit 020bae80a5
3 changed files with 88 additions and 33 deletions

View File

@@ -620,7 +620,30 @@ function UserSessions()
}
return (ret);
};
this.findEnv = function findEnv(uid, env)
{
var uname = this.getUsername(uid);
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = '';
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdin.write("ps -e -o pid -o user | grep " + uname + " | awk '{ print $1 }'\nexit\n");
child.waitExit();
var lines = child.stdout.str.split('\n');
for (var n in lines)
{
var ln = lines[n].trim();
if (ln.length > 0)
{
var e = this.getEnvFromPid(ln);
if (e[env])
{
return (e[env]);
}
}
}
return (null);
};
this.on('changed', this._recheckLoggedInUsers); // For linux Lock/Unlock monitoring, we need to watch for LogOn/LogOff, and keep track of the UID.