Sha256: 8a7b772276e1e1ec57d0e48246dbbe043817c4719e41551591bae55ef8d9dd65

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

module Process
  def exists?(pid)
    Process.kill(0, pid)
    true
  rescue => e
    false
  end

  def create_pid(path)
    Pathname(path).write(Process.pid)
  end

  def get_pid(path)
    File.read(path).to_i
  rescue Errno::ENOENT
    false
  end

  def remove_pidfile(path)
    File.delete(path)
  rescue Errno::ENOENT
    false
  end

  module_function :exists?, :create_pid, :get_pid, :remove_pidfile
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rooftop-spektrix_sync-0.0.3.2 lib/rooftop/spektrix_sync/process.rb
rooftop-spektrix_sync-0.0.3 lib/rooftop/spektrix_sync/process.rb
rooftop-spektrix_sync-0.0.2.15 lib/rooftop/spektrix_sync/process.rb