mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-12 14:23:40 +00:00
Updated consoleUid, to look at $DISPLAY when checking to see what users are logged in locally
This commit is contained in:
@@ -653,7 +653,7 @@ function UserSessions()
|
||||
}
|
||||
this.consoleUid = function consoleUid()
|
||||
{
|
||||
var checkstr = process.platform == 'darwin' ? 'console' : ':0';
|
||||
var checkstr = process.platform == 'darwin' ? 'console' : process.env['DISPLAY'];
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stdout.str = '';
|
||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||
@@ -667,12 +667,13 @@ function UserSessions()
|
||||
tokens = lines[i].split(' ');
|
||||
for (j = 1; j < tokens.length; ++j)
|
||||
{
|
||||
if (tokens[j].length > 0 && tokens[j] == checkstr)
|
||||
if (tokens[j].length > 0 && (tokens[j] == checkstr || tokens[j] == ('(' + checkstr + ')')))
|
||||
{
|
||||
return (parseInt(this._users()[tokens[0]]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw ('nobody logged into console');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user