1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-14 07:13:37 +00:00

fixed getEnvFromPid() for freebsd

This commit is contained in:
Bryan Roe
2019-06-22 01:20:16 -07:00
parent c9f0bff898
commit ae3bff9e18

View File

@@ -622,8 +622,9 @@ function UserSessions()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("procstat -e " + pid + " | grep " + pid + " | awk '{ $1=\"\"; $2=\"\"; print $0 }' | tr \"\\ \" \"\\n\" | awk -F= '{ if($1==\"\") { print $0 }}'\nexit\n");
child.stdin.write("procstat -e " + pid + " | grep " + pid + " | awk '{ $1=\"\"; $2=\"\"; print $0 }' | tr \"\\ \" \"\\n\"\nexit\n");
child.waitExit();
var env;
var tokens = child.stdout.str.trim().split('\n');
for(var i in tokens)
@@ -887,4 +888,4 @@ function getTokens(str)
return (columns);
}
module.exports = new UserSessions();
module.exports = new UserSessions();