(self, tid: str, proc: subprocess.Popen)
| 46 | return task |
| 47 | |
| 48 | def _wait(self, tid: str, proc: subprocess.Popen) -> None: |
| 49 | out = "" |
| 50 | try: |
| 51 | out, _ = proc.communicate() |
| 52 | except Exception: # noqa: BLE001 |
| 53 | pass |
| 54 | with self._lock: |
| 55 | t = self._tasks.get(tid) |
| 56 | if t is not None: |
| 57 | t.output = (out or "")[-_MAX_OUTPUT:] |
| 58 | t.exit_code = proc.returncode |
| 59 | if t.status != "killed": |
| 60 | t.status = "done" if proc.returncode == 0 else "failed" |
| 61 | self._procs.pop(tid, None) |
| 62 | |
| 63 | def list(self) -> list[BgTask]: |
| 64 | with self._lock: |
nothing calls this directly
no test coverage detected