Module: Daemonz::ProcTable

Defined in:
lib/daemonz/process.rb

Overview

Mocks the sys-proctable gem using ps.

This is useful even if sys-proctable is available, because it may fail for random reasons.

Defined Under Namespace

Classes: ProcInfo

Class Method Summary collapse

Class Method Details

.ps_emulationObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/daemonz/process.rb', line 14

def self.ps_emulation
  retval = []
  ps_output = `ps ax`
  ps_output.each_line do |pline|
    pdata = pline.split(nil, 5)
    pinfo = ProcInfo.new(pdata[0].strip, pdata[4].strip)
    retval << pinfo
  end
  return retval
end