Class: ArcadiaUtils
- Inherits:
-
Object
- Object
- ArcadiaUtils
- Defined in:
- lib/a-core.rb
Class Method Summary collapse
Class Method Details
.unix_child_pids(_ppid) ⇒ Object
3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 |
# File 'lib/a-core.rb', line 3205 def ArcadiaUtils.unix_child_pids(_ppid) ret = Array.new readed = '' open("|ps -o pid,ppid ax | grep #{_ppid}", "r"){|f| readed = f.read } apids = readed.split apids.each_with_index do |v,i| ret << v if i % 2 == 0 && v != _ppid.to_s end subpids = Array.new ret.each{|ccp| subpids.concat(unix_child_pids(ccp)) } ret.concat(subpids) end |