mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-05 18:13:38 +00:00
1. added 'getGroupID' for macos user-sessions
2. added support for per-user LaunchAgents on MacOS
This commit is contained in:
@@ -652,6 +652,15 @@ function UserSessions()
|
||||
}
|
||||
else if(process.platform == 'darwin')
|
||||
{
|
||||
this.getGroupID = function getGroupID(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("id " + uid + " | awk '{ split($2, gid, \"=\"); if(gid[1]==\"gid\") { split(gid[2], gidnum, \"(\"); print gidnum[1]; } }'\nexit\n");
|
||||
child.waitExit();
|
||||
return (parseInt(child.stdout.str.trim()));
|
||||
}
|
||||
this.getUsername = function getUsername(uid)
|
||||
{
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
|
||||
Reference in New Issue
Block a user