class Puma::ControlCLI

def send_signal

def send_signal
  unless @pid
    raise 'Neither pid nor control url available'
  end
  begin
    sig = CMD_PATH_SIG_MAP[@command]
    if sig.nil?
      @stdout.puts "'#{@command}' not available via pid only"
      @stdout.flush unless @stdout.sync
      return
    elsif sig.start_with? 'SIG'
      if Signal.list.key? sig.sub(/\ASIG/, '')
        Process.kill sig, @pid
      else
        raise "Signal '#{sig}' not available'"
      end
    elsif @command == 'status'
      begin
        Process.kill 0, @pid
        @stdout.puts 'Puma is started'
        @stdout.flush unless @stdout.sync
      rescue Errno::ESRCH
        raise 'Puma is not running'
      end
      return
    end
  rescue SystemCallError
    if @command == 'restart'
      start
    else
      raise "No pid '#{@pid}' found"
    end
  end
  message "Command #{@command} sent success"
end