mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-12 06:13:43 +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()
|
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']);
|
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
child.stdout.str = '';
|
child.stdout.str = '';
|
||||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
@@ -667,12 +667,13 @@ function UserSessions()
|
|||||||
tokens = lines[i].split(' ');
|
tokens = lines[i].split(' ');
|
||||||
for (j = 1; j < tokens.length; ++j)
|
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]]));
|
return (parseInt(this._users()[tokens[0]]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ('nobody logged into console');
|
throw ('nobody logged into console');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user