From: Jan Kiszka Date: Tue, 15 Jun 2010 22:38:46 +0000 (+0200) Subject: QMP: Fix python helper /wrt long return strings X-Git-Tag: qemu-xen-4.2.0~2580^2~18 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bbafc7a8798bc9ed1380e75033544e0614d344c7;p=qemu-upstream-4.2-testing.git 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 Signed-off-by: Luiz Capitulino --- diff --git a/QMP/qmp.py b/QMP/qmp.py index d9da603be..4062f84f3 100644 --- a/QMP/qmp.py +++ b/QMP/qmp.py @@ -63,10 +63,14 @@ class QEMUMonitorProtocol: def __json_read(self): 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: return def __init__(self, filename): self.filename = filename self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + self.sockfile = self.sock.makefile()