0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

prevent zombie processes

This commit is contained in:
2026-01-09 16:14:15 +01:00
parent 03f90b344f
commit 19daa6bcc4
2 changed files with 9 additions and 1 deletions

View File

@@ -28,7 +28,13 @@ class ProcessManager(ABC_ProcessManager):
return pr
def anything_playing(self) -> bool:
with self.lock:
self.processes = [p for p in self.processes if p.process.poll() is None]
alive = []
for p in self.processes:
if p.process.poll() is None: alive.append(p)
else:
try: p.process.wait(timeout=0)
except subprocess.TimeoutExpired: pass
self.processes = alive
return bool(self.processes)
def stop_all(self, timeout: float | None = None) -> None:
with self.lock: