mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
4b84d87449
commit
80ded8e99d
2 changed files with 59 additions and 46 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue