From 80ded8e99d9fc44c206f6b2fae6638df7dcf9305 Mon Sep 17 00:00:00 2001 From: Robert Foley Date: Fri, 24 Jul 2020 07:45:08 +0100 Subject: python/qemu: Change ConsoleSocket to optionally drain socket. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Alex Bennée Message-Id: <20200717203041.9867-3-robert.foley@linaro.org> Message-Id: <20200724064509.331-16-alex.bennee@linaro.org> --- python/qemu/machine.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'python/qemu/machine.py') diff --git a/python/qemu/machine.py b/python/qemu/machine.py index a09768e9f9..82f3731fc3 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 -- cgit 1.4.1