[libvirt] [PATCH v2 2/3] virsh: qemu-monitor-command: Don't print extra newline with --pretty

Peter Krempa pkrempa at redhat.com
Mon Aug 1 11:34:56 UTC 2016


The prettified JSON string already contains a newline so don't print
another one. This allows to pipe the json output (in conjunction with
the --quiet option) to files without having to truncate them afterwards.
---
 tools/virsh-domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6c1bc2f..ff71193 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8975,6 +8975,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
         if (pretty && (tmp = virJSONValueToString(pretty, true))) {
             VIR_FREE(result);
             result = tmp;
+            virTrimSpaces(result, NULL);
         } else {
             vshResetLibvirtError();
         }
-- 
2.9.2




More information about the libvir-list mailing list