mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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