Skip to content

Commit

Permalink
python: add __repr__ to ConsoleSocket to aid debugging
Browse files Browse the repository at this point in the history
While attempting to debug some console weirdness I thought it would be
worth making it easier to see what it had inside.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20201210190417.31673-6-alex.bennee@linaro.org>
  • Loading branch information
stsquad authored and bonzini committed Jan 2, 2021
1 parent c87ea11 commit afded35
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/qemu/console_socket.py
Expand Up @@ -45,6 +45,13 @@ def __init__(self, address: str, file: Optional[str] = None,
if drain:
self._drain_thread = self._thread_start()

def __repr__(self) -> str:
s = super().__repr__()
s = s.rstrip(">")
s = "%s, logfile=%s, drain_thread=%s>" % (s, self._logfile,
self._drain_thread)
return s

def _drain_fn(self) -> None:
"""Drains the socket and runs while the socket is open."""
while self._open:
Expand Down

0 comments on commit afded35

Please sign in to comment.