From patchwork Sun May 23 10:59:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 53321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by ozlabs.org (Postfix) with ESMTP id 0B87CB7D2E for ; Sun, 23 May 2010 21:30:37 +1000 (EST) Received: from localhost ([127.0.0.1]:36290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OG9J8-0006xP-8x for incoming@patchwork.ozlabs.org; Sun, 23 May 2010 07:25:26 -0400 Received: from [140.186.70.92] (port=48676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OG8uS-0004IO-Ld for qemu-devel@nongnu.org; Sun, 23 May 2010 07:00:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OG8uF-0004RM-4q for qemu-devel@nongnu.org; Sun, 23 May 2010 06:59:55 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:34397) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OG8uD-0004Pp-0W for qemu-devel@nongnu.org; Sun, 23 May 2010 06:59:41 -0400 Received: from smtp01.web.de ( [172.20.0.243]) by fmmailgate01.web.de (Postfix) with ESMTP id 9C41315B16D25; Sun, 23 May 2010 12:59:40 +0200 (CEST) Received: from [88.65.39.229] (helo=localhost.localdomain) by smtp01.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #4) id 1OG8uA-0003cZ-02; Sun, 23 May 2010 12:59:39 +0200 From: Jan Kiszka To: qemu-devel@nongnu.org, Anthony Liguori Date: Sun, 23 May 2010 12:59:29 +0200 Message-Id: <834d0bba21d14e502c1f7274eb244ed3b682ae1d.1274612367.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX192Gg6JYZFnc7LKGV/40mPgTxOhaBfhj9A6TNRi g11nGFtqEq+6zIrcb2jbk2NDNlZql/X9fKOOrjOmLDWcOuaRX2 awwrjR+Fs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Juan Quintela , Jan Kiszka , Markus Armbruster , Luiz Capitulino , Blue Swirl , Avi Kivity Subject: [Qemu-devel] [PATCH v3 16/17] QMP: Fix python helper /wrt long return strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Remove the arbitrary limitation of 1024 characters per return string and read complete lines instead. Required for device_show. Signed-off-by: Jan Kiszka --- QMP/qmp.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/QMP/qmp.py b/QMP/qmp.py index d9da603..4062f84 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()