test: Wettlauf beim Lesen von /proc/<pid>/stat abfangen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ce5bef8306
commit
d46b1ba5c5
@@ -127,7 +127,7 @@ def _alive(pid: int) -> bool:
|
|||||||
try:
|
try:
|
||||||
with open(f"/proc/{pid}/stat") as fh:
|
with open(f"/proc/{pid}/stat") as fh:
|
||||||
return fh.read().split(")")[-1].split()[0] != "Z"
|
return fh.read().split(")")[-1].split()[0] != "Z"
|
||||||
except FileNotFoundError:
|
except (FileNotFoundError, ProcessLookupError): # verschwindet beim Lesen → ESRCH
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user