terminate_process_group: also properly yield iterator when we return early

This commit is contained in:
Jörg Thalheim
2025-07-04 17:46:48 +02:00
parent 3e2459fa40
commit c5bc1a225d

View File

@@ -179,6 +179,7 @@ def terminate_process_group(process: subprocess.Popen) -> Iterator[None]:
try: try:
process_group = os.getpgid(process.pid) process_group = os.getpgid(process.pid)
except ProcessLookupError: except ProcessLookupError:
yield
return return
if process_group == os.getpgid(os.getpid()): if process_group == os.getpgid(os.getpid()):
msg = "Bug! Refusing to terminate the current process group" msg = "Bug! Refusing to terminate the current process group"