MCPcopy Create free account
hub / github.com/Louisym/MiniCC / kill_process_tree

Method kill_process_tree

tutorials/14_bash_engine_deep_dive.py:712–717  ·  view source on GitHub ↗

杀死进程树 — 不只是主进程,还有所有子进程

(self, pid: int)

Source from the content-addressed store, hash-verified

710 return 0, False
711
712 def kill_process_tree(self, pid: int):
713 """杀死进程树 — 不只是主进程,还有所有子进程"""
714 try:
715 os.killpg(os.getpgid(pid), signal.SIGKILL)
716 except (ProcessLookupError, PermissionError):
717 pass
718
719 wd = OutputWatchdog("/tmp/example-output.txt", MAX_OUTPUT_SIZE)
720 print(f" 最大输出: {MAX_OUTPUT_SIZE / 1024 / 1024:.0f}MB")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected