Return daemon status.
(self, fswatcher_dump_file: str | None = None)
| 292 | # Command functions (run in the server via RPC). |
| 293 | |
| 294 | def cmd_status(self, fswatcher_dump_file: str | None = None) -> dict[str, object]: |
| 295 | """Return daemon status.""" |
| 296 | res: dict[str, object] = {} |
| 297 | res.update(get_meminfo()) |
| 298 | if fswatcher_dump_file: |
| 299 | data = self.fswatcher.dump_file_data() if hasattr(self, "fswatcher") else {} |
| 300 | # Using .dumps and then writing was noticeably faster than using dump |
| 301 | s = json.dumps(data) |
| 302 | with open(fswatcher_dump_file, "w") as f: |
| 303 | f.write(s) |
| 304 | return res |
| 305 | |
| 306 | def cmd_stop(self) -> dict[str, object]: |
| 307 | """Stop daemon.""" |
nothing calls this directly
no test coverage detected