mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 08:40:29 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
28 lines
421 B
Ruby
28 lines
421 B
Ruby
# frozen_string_literal: true
|
|
|
|
require File.expand_path("../../../config/environment", __FILE__)
|
|
|
|
puts "Parent is now loaded"
|
|
|
|
class ForkExecDemon < Demon::Base
|
|
def self.prefix
|
|
"fork-exec-child"
|
|
end
|
|
|
|
def run
|
|
if @pid = fork
|
|
write_pid_file
|
|
return
|
|
end
|
|
|
|
exec "./child #{parent_pid}"
|
|
end
|
|
end
|
|
|
|
ForkExecDemon.start(1, verbose: true)
|
|
|
|
while true
|
|
ForkExecDemon.ensure_running
|
|
sleep 0.1
|
|
end
|