Method
wait_for
(self, needle: str, timeout_s: float)
Source from the content-addressed store, hash-verified
| 98 | self._thread.start() |
| 99 | |
| 100 | def wait_for(self, needle: str, timeout_s: float) -> None: |
| 101 | deadline = time.time() + timeout_s |
| 102 | tail: list[str] = [] |
| 103 | while time.time() < deadline: |
| 104 | try: |
| 105 | line = self.queue.get(timeout=0.2) |
| 106 | tail.append(line) |
| 107 | if needle in line: |
| 108 | return |
| 109 | except queue.Empty: |
| 110 | pass |
| 111 | raise TimeoutError(f"timed out waiting for {needle!r}; tail={tail[-12:]}") |
| 112 | |
| 113 | |
| 114 | class PFlashDaemon: |
Tested by
no test coverage detected