2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-01 21:34:20 -05:00
|
|
|
require File.expand_path("../../config/environment", __FILE__)
|
|
|
|
|
|
|
|
def pretty
|
|
|
|
puts "<before>"
|
|
|
|
puts PrettyText.cook("My pid is #{Process.pid}")
|
2016-11-02 06:19:16 -05:00
|
|
|
GC.start
|
|
|
|
sleep 1
|
|
|
|
puts "done gc"
|
2016-11-01 21:34:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Discourse.after_fork
|
|
|
|
pretty
|
|
|
|
|
|
|
|
child =
|
|
|
|
fork do
|
|
|
|
Discourse.after_fork
|
|
|
|
pretty
|
|
|
|
grand_child =
|
2023-01-07 05:53:14 -06:00
|
|
|
fork do
|
2016-11-01 21:34:20 -05:00
|
|
|
Discourse.after_fork
|
2023-01-07 05:53:14 -06:00
|
|
|
pretty
|
2016-11-01 21:34:20 -05:00
|
|
|
puts "try to exit"
|
|
|
|
Process.kill "KILL", Process.pid
|
2023-01-07 05:53:14 -06:00
|
|
|
end
|
2016-11-01 21:34:20 -05:00
|
|
|
puts "before wait 2"
|
|
|
|
Process.wait grand_child
|
|
|
|
puts "after wait 2"
|
|
|
|
Process.kill "KILL", Process.pid
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "before wait 1"
|
|
|
|
Process.wait child
|
|
|
|
puts "after wait 1"
|