(pid)
| 70 | |
| 71 | |
| 72 | def kill_process_tree(pid): |
| 73 | try: |
| 74 | parent = psutil.Process(pid) |
| 75 | children = parent.children(recursive=True) |
| 76 | for child in children: |
| 77 | child.terminate() |
| 78 | gone, still_alive = psutil.wait_procs(children, timeout=5) |
| 79 | for p in still_alive: |
| 80 | p.kill() |
| 81 | parent.terminate() |
| 82 | parent.wait(5) |
| 83 | except psutil.NoSuchProcess: |
| 84 | pass |
| 85 | |
| 86 | |
| 87 | def signal_handler(signum, frame): |