test(scripts): treat a process that exits mid-read as gone

Reading /proc/<pid>/stat raises ProcessLookupError when the process
exits between the open and the read, which made the lane-kill tests
fail now and then.

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-24 09:52:43 +00:00
1 parent 4f0b8e0cfe
commit 3726b5c53f
1 file changed
+1 -1
+1 -1
View File
@@ -353,7 +353,7 @@ def alive(pid):
"""Whether pid is a running process, not gone or a zombie."""
try:
stat = pathlib.Path(f"/proc/{pid}/stat").read_text()
except FileNotFoundError:
except (FileNotFoundError, ProcessLookupError): # gone before or during the read
return False
return stat.rsplit(")", 1)[1].split()[0] != "Z"