1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-14 15:23:39 +00:00

updated user-sessions on linux, so that if 'who' is not supported, consoleUid will return root. This fixes platforms such as puppy, where the platform is logged in as root.

This commit is contained in:
Bryan Roe
2019-07-25 15:03:28 -07:00
parent bd0bf102cd
commit d700f16325
2 changed files with 11 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -544,11 +544,13 @@ function UserSessions()
this.consoleUid = function consoleUid()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = '';
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stderr.str = ''; child.stderr.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdin.write('who\nexit\n');
child.waitExit();
if (child.stderr.str != '') { return (0); }
var lines = child.stdout.str.split('\n');
var tokens, i, j;
for (i in lines) {