class RakeUp::Utilities::ProcessCheck

Attributes

error[R]
pid[R]

Public Class Methods

new(pid) click to toggle source
# File lib/rakeup/utilities/process_check.rb, line 6
def initialize(pid)
  @pid = pid.to_i
end

Public Instance Methods

run() click to toggle source
# File lib/rakeup/utilities/process_check.rb, line 10
def run
  begin
    info = Process.getpgid(pid)
    @running = true
  rescue Errno::ESRCH => error
    @running = false
    @error = error
  end
end
running?() click to toggle source
# File lib/rakeup/utilities/process_check.rb, line 20
def running?
  @running
end
to_s() click to toggle source
# File lib/rakeup/utilities/process_check.rb, line 24
def to_s
  if running?
    "Found process running with pid #{pid}"
  else
    "Unable to find process with pid #{pid}: #{@error}"
  end
end