Class: Serverspec::Type::Process

Inherits:
Base
  • Object
show all
Defined in:
lib/serverspec/type/process.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_ary, #to_s

Constructor Details

This class inherits a constructor from Serverspec::Type::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth) ⇒ Object



10
11
12
13
14
15
# File 'lib/serverspec/type/process.rb', line 10

def method_missing(meth)
  ret = backend.run_command(commands.get_process(@name, :format => "#{meth.to_s}="))
  val = ret[:stdout].strip
  val = val.to_i if val.match(/^\d+$/)
  val
end

Instance Method Details

#running?Boolean

Returns:



5
6
7
8
# File 'lib/serverspec/type/process.rb', line 5

def running?
  pid = backend.run_command(commands.get_process(@name, :format => "pid="))[:stdout]
  not pid.empty?
end