module Mixlib::ShellOut::Windows

def kill_process_tree(pid, wmi, logger)

is passed in since each creates its own WMI rpc process
none remain. Important that a single WmiLite instance
calls itself querying for children child procs until
recursively kills all child processes of given pid
def kill_process_tree(pid, wmi, logger)
  wmi.query("select * from Win32_Process where ParentProcessID=#{pid}").each do |instance|
    next if unsafe_process?(instance.wmi_ole_object.name, logger)
    child_pid = instance.wmi_ole_object.processid
    kill_process_tree(child_pid, wmi, logger)
    kill_process(instance, logger)
  end
end