Skip to content

Commit 209a45e

Browse files
committed
fix #18 get the same name COMMAND for child under darwin
1 parent 10b90e3 commit 209a45e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ module.exports = function childrenOfPid(pid, callback) {
2828
// ps 20688 16965 R+
2929
// ```
3030
//
31+
// Darwin:
32+
// $ ps -A -o comm,ppid,pid,stat
33+
// COMM PPID PID STAT
34+
// /sbin/launchd 0 1 Ss
35+
// /usr/libexec/Use 1 43 Ss
36+
//
3137
// Win32:
3238
// 1. wmic PROCESS WHERE ParentProcessId=4604 GET Name,ParentProcessId,ProcessId,Status)
3339
// 2. The order of head columns is fixed
@@ -112,6 +118,9 @@ function normalizeHeader(str) {
112118
case 'Status':
113119
return 'STAT';
114120
break;
121+
case 'COMM': // for darwin
122+
return 'COMMAND';
123+
break;
115124
default:
116125
throw new Error('Unknown process listing header: ' + str);
117126
}

0 commit comments

Comments
 (0)