]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: qemu-monitor-command: Don't print extra newline with --pretty
authorPeter Krempa <pkrempa@redhat.com>
Mon, 1 Aug 2016 04:13:39 +0000 (06:13 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Aug 2016 14:21:53 +0000 (16:21 +0200)
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

index 9c496b90dd3b62062c757d5603d7c05d4320b176..fc77f162f0d9701911631596c15b9fcc1d1922fa 100644 (file)
@@ -8972,6 +8972,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
         if (pretty && (tmp = virJSONValueToString(pretty, true))) {
             VIR_FREE(result);
             result = tmp;
+            virTrimSpaces(result, NULL);
         } else {
             vshResetLibvirtError();
         }