def _parent_of_ignores_sigterm(child_process_killed, child_pid, process_done, setup_done): child = multiprocessing.Process(target=TestHelpers._ignores_sigterm, args=[child_pid, setup_done]) child.start() if setup_done.acquire(timeout=1.0): helpers.kill_process_tree(logging.getLogger(), os.getpid(), timeout=1.0) # Process.is_alive doesnt work with SIGKILL if not psutil.pid_exists(child_pid.value): child_process_killed.value = 1 process_done.release()
def terminate(self): if self.process and psutil.pid_exists(self.process.pid): kill_process_tree(self.log, self.process.pid)