On Fri, Mar 22, 2019 at 04:33:41PM +0100, Pino Toscano wrote:
Enhance the helper printf function for machine readable output to
always
flush after each string: this way, readers of the machine readable
stream can get the output as soon as it is outputted.
---
common/mltools/tools_utils.ml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml
index 5a35708cd..ade4cb37f 100644
--- a/common/mltools/tools_utils.ml
+++ b/common/mltools/tools_utils.ml
@@ -59,7 +59,11 @@ let machine_readable () =
| None -> None
| Some chan ->
let pr fs =
- ksprintf (output_string chan) fs
+ let out s =
+ output_string chan s;
+ flush chan
+ in
+ ksprintf out fs
in
Some { pr }
I was looking to see if any of the existing calls to machine_readable
are using %! (a format directive which causes the channel to be
flushed). I had expected there would be some, but my simple "git
grep"s aren't turning up anything right now.
Anyway, ACK 1/4 and 2/4.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW