lib/cumuli/ps.rb in cumuli-0.3.0 vs lib/cumuli/ps.rb in cumuli-0.3.1

- old
+ new

@@ -43,12 +43,21 @@ def line(pid) lines.detect{|l| l.match(/^#{pid} /)} end def tree(pid) - child_pids = ppid_hash[pid] - puts "#{pid} => #{child_pids}" - child_pids.map{|cpid| tree(cpid) } if child_pids + collection = [] + if kids = children(pid) + collection += kids + kids.each do |k| + collection += tree(k) + end + end + collection + end + + def children(pid) + ppid_hash[pid] end def report(pid) tree(pid) puts "\n"