Refactor #stop to reference ALL_PROCESSES for a bit clearer readability

This commit is contained in:
R. Tyler Croy
2012-04-10 20:35:03 -07:00
parent 48f764e347
commit b2bf95479e

View File

@@ -63,7 +63,7 @@ class Foreman::Engine
def stop(name, signal='SIGTERM')
running_processes.each do |pid, process|
unless name.nil?
unless name == ALL_PROCESSES
# Comparing against process.entry.name instead of process.name to
# make sure we match the process name exactly for any/all
# concurrently running processes by this name
@@ -104,10 +104,10 @@ private ######################################################################
return if @terminating
@terminating = true
Timeout.timeout(5) do
stop(nil)
stop ALL_PROCESSES
end
rescue Timeout::Error
stop(nil, 'SIGKILL')
stop(ALL_PROCESSES, 'SIGKILL')
rescue Errno::ECHILD
end