fix: handle asyncio.subprocess.Process in list_processes

ProcessManager.list_processes() was calling .poll() which only
exists on subprocess.Popen, not asyncio.subprocess.Process.
Since auto_background.py uses asyncio.create_subprocess_exec(),
the stored process objects don't have poll(). Now checks for
.returncode directly for asyncio processes.
This commit is contained in:
2025-12-24 15:22:44 -08:00
parent 5869fe8c35
commit 3ee2eb56b5
@@ -47,7 +47,15 @@ class ProcessManager:
"""List all tracked processes."""
result = {}
for pid, proc in list(self._processes.items()):
if proc.poll() is None:
# Handle both subprocess.Popen and asyncio.subprocess.Process
# subprocess.Popen has .poll(), asyncio.subprocess.Process uses .returncode
try:
is_running = proc.poll() is None if hasattr(proc, 'poll') else proc.returncode is None
except Exception:
# If we can't determine, assume running
is_running = True
if is_running:
result[pid] = {
"pid": proc.pid,
"running": True,