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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]