class Goliath::Runner

def run

Returns:
  • (Nil) -
def run
  if options[:console]
    Goliath::Console.run!(setup_server)
    return
  end
  unless Goliath.env?(:test)
    $LOADED_FEATURES.unshift(File.basename($0))
    Dir.chdir(File.expand_path(File.dirname($0)))
  end
  if @daemonize
    Process.fork do
      Process.setsid
      exit if fork
      @pid_file ||= './goliath.pid'
      @log_file ||= File.expand_path('goliath.log')
      store_pid(Process.pid)
      File.umask(0000)
      log_extension = File.extname(@log_file)
      stdout_log_file = "#{File.dirname(@log_file)}/#{File.basename(@log_file, log_extension)}_stdout#{log_extension}"
      STDIN.reopen("/dev/null")
      STDOUT.reopen(stdout_log_file, "a")
      STDERR.reopen(STDOUT)
      run_server
      remove_pid
    end
  else
    run_server
  end
end