Skip to content

Commit

Permalink
Merge branch 'master' into release/v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gfs committed Jan 11, 2020
2 parents b2fff30 + 64d8521 commit c702086
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 36 deletions.
2 changes: 1 addition & 1 deletion Lib/Collectors/OpenPortCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private void ExecuteOsX()
{
try
{
var result = ExternalCommandRunner.RunExternalCommand("sudo", "lsof -Pn -i4 -i6");
string result = ExternalCommandRunner.RunExternalCommand("lsof -Pn -i4 -i6");

foreach (var _line in result.Split('\n'))
{
Expand Down
35 changes: 0 additions & 35 deletions Lib/Collectors/ServiceCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,41 +221,6 @@ public void ExecuteMacOs()
{
Log.Error("Error executing {0}", "launchctl list");
}
try
{
// Then get the system processes
var result = ExternalCommandRunner.RunExternalCommand("sudo", "launchctl list");

foreach (var _line in result.Split('\n'))
{
// Lines are formatted like this, with single tab separation:
// PID Exit Name
// 1015 0 com.apple.appstoreagent
var _fields = _line.Split('\t');
if (_fields.Length < 3 || _fields[0].Contains("PID"))
{
continue;

}
var obj = new ServiceObject()
{
DisplayName = _fields[2],
Name = _fields[2],
// If we have a current PID then it is running.
State = (_fields[0].Equals("-")) ? "Stopped" : "Running"
};

if (!outDict.ContainsKey(obj.Identity))
{
DatabaseManager.Write(obj, this.RunId);
outDict.Add(obj.Identity, obj);
}
}
}
catch (ExternalException)
{
Log.Error("Error executing {0}", "sudo launchctl list");
}
}

/// <summary>
Expand Down

0 comments on commit c702086

Please sign in to comment.