Class: ArcadiaUtils
- Inherits:
-
Object
- Object
- ArcadiaUtils
- Defined in:
- lib/a-core.rb
Class Method Summary collapse
Class Method Details
.exec(_cmd_ = nil) ⇒ Object
4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 |
# File 'lib/a-core.rb', line 4138 def ArcadiaUtils.exec(_cmd_=nil) return nil if _cmd_.nil? to_ret = '' begin open("|#{_cmd_}", "r"){|f| #to_ret = f.readlines to_ret = f.read } rescue RuntimeError => e Arcadia.runtime_error(e) end to_ret end |
.unix_child_pids(_ppid) ⇒ Object
4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 |
# File 'lib/a-core.rb', line 4123 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 |