class KuberKit::Tools::ProcessCleaner
Public Instance Methods
clean()
click to toggle source
# File lib/kuber_kit/tools/process_cleaner.rb, line 7 def clean stop_threads stop_child_proceses end
stop_child_proceses()
click to toggle source
# File lib/kuber_kit/tools/process_cleaner.rb, line 20 def stop_child_proceses find_all_child_processes.each do |pid| system_commands.kill_process(local_shell, pid) end end
stop_threads()
click to toggle source
# File lib/kuber_kit/tools/process_cleaner.rb, line 12 def stop_threads Thread.list.each do |t| t.abort_on_exception = false t.report_on_exception = false Thread.kill(t) if t != Thread.current end end
Private Instance Methods
find_all_child_processes()
click to toggle source
# File lib/kuber_kit/tools/process_cleaner.rb, line 28 def find_all_child_processes pids = system_commands.find_pids_by_name(local_shell, "KIT=#{Process.pid}") pids + get_child_pids(pids) end
get_child_pids(pids)
click to toggle source
# File lib/kuber_kit/tools/process_cleaner.rb, line 33 def get_child_pids(pids) pids .map{ |p| system_commands.get_child_pids(local_shell, p) } .flatten end