diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99efb6a..15d9aa4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
+| 5.23.16 | 2024-12-13 | `networkConnections()` refactored PID parsing (macOS) |
| 5.23.15 | 2024-12-21 | `users()`, `wifiNetworks()` fixed parsing (macOS Seguoia) |
| 5.23.14 | 2024-12-18 | `chassis()` new chassis detection (macOS) |
| 5.23.13 | 2024-12-14 | `wifiConnections()` improved BSSID parsing (windows) |
diff --git a/docs/history.html b/docs/history.html
index 0c2ff41..29c43ea 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -57,6 +57,11 @@
+
+ | 5.23.16 |
+ 2024-12-22 |
+ networkConnections() refactored PID parsing (macOS) |
+
| 5.23.15 |
2024-12-21 |
diff --git a/docs/index.html b/docs/index.html
index 4520f7f..a4192ee 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.23.15
+ New Version: 5.23.16
diff --git a/lib/network.js b/lib/network.js
index 2b865ad..f930555 100644
--- a/lib/network.js
+++ b/lib/network.js
@@ -1417,9 +1417,10 @@ function getProcessName(processes, pid) {
}
});
cmd = cmd.split(' -')[0];
- // return cmd;
- const cmdParts = cmd.split('/');
- return cmdParts[cmdParts.length - 1];
+ cmd = cmd.split(' /')[0];
+ return cmd;
+ // const cmdParts = cmd.split('/');
+ // return cmdParts[cmdParts.length - 1];
}
function networkConnections(callback) {
@@ -1546,7 +1547,7 @@ function networkConnections(callback) {
lines.forEach(function (line) {
line = line.replace(/ +/g, ' ').split(' ');
- const hasTransferred = line.length >= 19;
+ const hasTransferred = line.length >= 17;
if (line.length >= 8) {
let localip = line[3];
let localport = '';
@@ -1566,7 +1567,7 @@ function networkConnections(callback) {
}
const hasState = states.indexOf(line[5]) >= 0;
let connstate = hasState ? line[5] : 'UNKNOWN';
- let pid = parseInt(line[8 + (hasState ? 0 : -1) + (hasTransferred ? 2 : 0)], 10);
+ let pid = parseInt(line[6 + (hasState ? 0 : -1) + (hasTransferred ? 2 : 0)], 10);
if (connstate) {
result.push({
protocol: line[0],