2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-08-20 18:52:44 +08:00

DEV: handle termination cleanly in autospec

This commit is contained in:
Sam 2018-06-18 13:20:23 +10:00
parent 91b73e0c2d
commit cc3fc87dd7
4 changed files with 52 additions and 14 deletions

View file

@ -61,11 +61,14 @@ class Demon::Base
end
end
def stop_signal
"HUP"
end
def stop
@started = false
if @pid
# TODO configurable stop signal
Process.kill("HUP", @pid)
Process.kill(stop_signal, @pid)
wait_for_stop = lambda {
timeout = @stop_timeout
@ -82,7 +85,7 @@ class Demon::Base
wait_for_stop.call
if alive?
STDERR.puts "Process would not terminate cleanly, force quitting. pid: #{@pid}"
STDERR.puts "Process would not terminate cleanly, force quitting. pid: #{@pid} #{self.class}"
Process.kill("KILL", @pid)
end