module Padrino::Cli::Adapter

Public Class Methods

start(options) click to toggle source

Start for the given options a rackup handler

# File lib/padrino-core/cli/adapter.rb, line 8
def start(options)
  Padrino.run!(Utils.symbolize_keys(options))
end
stop(options) click to toggle source

Method that stop (if exist) a running Padrino.application

# File lib/padrino-core/cli/adapter.rb, line 13
def stop(options)
  options = Utils.symbolize_keys(options)
  if File.exist?(options[:pid])
    pid = File.read(options[:pid]).to_i
    puts "=> Sending INT to process with pid #{pid}"
    begin
      Process.kill(2, pid)
    rescue Errno::ESRCH, RangeError => error
      puts error.message
      exit
    rescue Errno::EPERM => error
      puts error.message
      abort
    end
  else
    puts "=> #{options[:pid]} not found!"
    abort
  end
end