1
0
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:
Bryan Roe
2019-06-03 15:15:25 -07:00
parent 5b0a4899e2
commit 3ab7316172
2 changed files with 53 additions and 5 deletions

View File

@@ -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']);