Sha256: 37834ed8a19c1b06f06c38efd5b7cab6d21f2cb0632d12e48c0950c9ace2f68c

Contents?: true

Size: 561 Bytes

Versions: 3

Compression:

Stored size: 561 Bytes

Contents

module FireAndForget
  class Server
    def self.parse(command_string)
      command = Command.load(command_string)
      run(command)
    end

    def self.run(cmd)
      cmd.run
    end

    def self.kill(task_name, signal="TERM")
      pid = pids[task_name]
      Process.kill(signal, pid) unless pid == 0
    end

    def self.status
      @status ||= {}
    end

    def self.set_pid(task_name, pid)
      pids[task_name] = pid.to_i
    end

    def self.get_pid(task)
      pids[task.name]
    end

    def self.pids
      @pids ||= {}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fire_and_forget-0.1.2 lib/fire_and_forget/server.rb
fire_and_forget-0.1.1 lib/fire_and_forget/server.rb
fire_and_forget-0.1.0 lib/fire_and_forget/server.rb