We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37b1a30 commit 4868abdCopy full SHA for 4868abd
index.js
@@ -73,12 +73,13 @@ module.exports = function childrenOfPid(pid, callback) {
73
return cb(null, row);
74
}),
75
es.writeArray(function (err, ps) {
76
- var parents = [pid],
+ var parents = {},
77
children = [];
78
79
+ parents[pid] = true;
80
ps.forEach(function (proc) {
- if (parents.indexOf(proc.PPID) !== -1) {
81
- parents.push(proc.PID)
+ if (parents[proc.PPID]) {
82
+ parents[proc.PID] = true;
83
children.push(proc)
84
}
85
});
0 commit comments