From fcfab7541020d835daab3f7143da321cf1def926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 26 Mar 2018 17:08:40 +0200 Subject: qmp-shell: learn to send commands with quoted arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use shlex to split the CLI command, respecting quoted arguments, and also comments. This allows to call for ex: (QEMU) human-monitor-command command-line="screendump /dev/null" {"execute": "human-monitor-command", "arguments": {"command-line": "screendump /dev/null"}} Signed-off-by: Marc-André Lureau Message-Id: <20180326150916.9602-3-marcandre.lureau@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Markus Armbruster --- scripts/qmp/qmp-shell | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/qmp') diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index a42306dd89..770140772d 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -74,6 +74,7 @@ import sys import os import errno import atexit +import shlex class QMPCompleter(list): def complete(self, text, state): @@ -219,7 +220,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] """ - cmdargs = cmdline.split() + cmdargs = shlex.split(cmdline) # Transactional CLI entry/exit: if cmdargs[0] == 'transaction(': -- cgit v1.2.3