perf_check icon indicating copy to clipboard operation
perf_check copied to clipboard

Don't daemonize the Rails server

Open Manfred opened this issue 5 years ago • 0 comments

If we don't deamonize the Rails server we have far more direct control over the process.

Open3.popen2e(
  'rails',
  'server',
  '--environment', rails_environment,
  '--binding', rails_hostname,
  '--port', rails_port.to_s,
  chdir: app_root
) do |stdin, output, thread|
  stdin.close
  # Do things and then quit the server.
  Process.kill('TERM', thread.pid)
  # After the process stopped we can read the entire server output. This is
  # useful when debugging broken runs and possibly digging performance
  # information out of the request logs.
  logger.debug(output.read)
end

Manfred avatar Nov 05 '19 12:11 Manfred