mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0022-common-mltools-make-sure-machine-readable-output-is-.patch

5ce0c7
From d60ef2eca9c0e51944a9c17806d6936af45907f5 Mon Sep 17 00:00:00 2001
46b2f6
From: Pino Toscano <ptoscano@redhat.com>
46b2f6
Date: Fri, 22 Mar 2019 11:36:41 +0100
46b2f6
Subject: [PATCH] common/mltools: make sure machine readable output is flushed
46b2f6
46b2f6
Enhance the helper printf function for machine readable output to always
46b2f6
flush after each string: this way, readers of the machine readable
46b2f6
stream can get the output as soon as it is outputted.
46b2f6
46b2f6
(cherry picked from commit abf1607f46ddc3d829a3688b9499a9bcd2319d19)
46b2f6
---
46b2f6
 common/mltools/tools_utils.ml | 6 +++++-
46b2f6
 1 file changed, 5 insertions(+), 1 deletion(-)
46b2f6
46b2f6
diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml
46b2f6
index 5a35708cd..ade4cb37f 100644
46b2f6
--- a/common/mltools/tools_utils.ml
46b2f6
+++ b/common/mltools/tools_utils.ml
46b2f6
@@ -59,7 +59,11 @@ let machine_readable () =
46b2f6
   | None -> None
46b2f6
   | Some chan ->
46b2f6
     let pr fs =
46b2f6
-      ksprintf (output_string chan) fs
46b2f6
+      let out s =
46b2f6
+        output_string chan s;
46b2f6
+        flush chan
46b2f6
+      in
46b2f6
+      ksprintf out fs
46b2f6
     in
46b2f6
     Some { pr }
46b2f6
 
46b2f6
-- 
5ce0c7
2.18.4
46b2f6