test: count a zombie grandchild as killed in the fake prisma cli
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-09-09 10:01:22 +00:00
parent db4dee5483
commit fdd6f60216

View file

@ -35,6 +35,14 @@ DB_ENV_KEYS = (
_db_env_snapshot_key = pytest.StashKey[dict[str, Optional[str]]]()
def _is_zombie(pid: int) -> bool:
try:
stat: Final = Path(f"/proc/{pid}/stat").read_text()
except OSError:
return False
return stat.rpartition(")")[2].split()[0] == "Z"
def _db_env_snapshot() -> dict[str, Optional[str]]:
return {key: os.environ.get(key) for key in DB_ENV_KEYS}
@ -136,6 +144,8 @@ class FakePrismaCli:
os.kill(pid, 0)
except ProcessLookupError:
return True
if _is_zombie(pid):
return True
time.sleep(0.05)
return False