diff options
author | Robert Foley <robert.foley@linaro.org> | 2020-07-24 07:45:08 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-07-27 09:41:56 +0100 |
commit | 80ded8e99d9fc44c206f6b2fae6638df7dcf9305 (patch) | |
tree | cd19ae09eb60738e74adf261acc20b6e803a0d4d /python/qemu/machine.py | |
parent | 4b84d87449f7f7cae5a032f40200915332b32a70 (diff) | |
download | qemu-80ded8e99d9fc44c206f6b2fae6638df7dcf9305.zip qemu-80ded8e99d9fc44c206f6b2fae6638df7dcf9305.tar.gz qemu-80ded8e99d9fc44c206f6b2fae6638df7dcf9305.tar.bz2 |
python/qemu: Change ConsoleSocket to optionally drain socket.
The primary purpose of this change is to clean up
machine.py's console_socket property to return a single type,
a ConsoleSocket.
ConsoleSocket now derives from a socket, which means that
in the default case (of not draining), machine.py
will see the same behavior as it did prior to ConsoleSocket.
Signed-off-by: Robert Foley <robert.foley@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200717203041.9867-3-robert.foley@linaro.org>
Message-Id: <20200724064509.331-16-alex.bennee@linaro.org>
Diffstat (limited to 'python/qemu/machine.py')
-rw-r--r-- | python/qemu/machine.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/python/qemu/machine.py b/python/qemu/machine.py index a09768e..82f3731 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -23,7 +23,6 @@ import os import subprocess import shutil import signal -import socket import tempfile from typing import Optional, Type from types import TracebackType @@ -673,12 +672,8 @@ class QEMUMachine: Returns a socket connected to the console """ if self._console_socket is None: - if self._drain_console: - self._console_socket = console_socket.ConsoleSocket( - self._console_address, - file=self._console_log_path) - else: - self._console_socket = socket.socket(socket.AF_UNIX, - socket.SOCK_STREAM) - self._console_socket.connect(self._console_address) + self._console_socket = console_socket.ConsoleSocket( + self._console_address, + file=self._console_log_path, + drain=self._drain_console) return self._console_socket |