Sha256: 75bdcf5836619dd851f50fcd9002fd9c899bab61667d9de2648e65aebbb49b6e

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

require 'drb/drb'

module Akephalos
  class RemoteClient
    @socket_file = "/tmp/akephalos.#{Process.pid}.sock"

    def self.start!
      remote_client = fork do
        exec("#{Akephalos::BIN_DIR + 'akephalos'} #{@socket_file}")
      end

      sleep 1 until File.exists?(@socket_file)

      at_exit { Process.kill(:INT, remote_client); File.unlink(@socket_file) }
    end

    def self.new
      start!
      DRb.start_service
      DRbObject.new_with_uri("drbunix://#{@socket_file}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
akephalos-0.0.4 lib/akephalos/remote_client.rb