QMP: Fix python helper /wrt long return strings
Remove the arbitrary limitation of 1024 characters per return string and read complete lines instead. Required for device_show. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
8d7e84571b
commit
bbafc7a879
@ -63,10 +63,14 @@ class QEMUMonitorProtocol:
|
|||||||
|
|
||||||
def __json_read(self):
|
def __json_read(self):
|
||||||
try:
|
try:
|
||||||
return json.loads(self.sock.recv(1024))
|
while True:
|
||||||
|
line = json.loads(self.sockfile.readline())
|
||||||
|
if not 'event' in line:
|
||||||
|
return line
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
|
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
|
self.sockfile = self.sock.makefile()
|
||||||
|
Loading…
Reference in New Issue
Block a user