[Libguestfs] [PATCH v2 2/4] common/mltools: make sure machine readable output is flushed
Richard W.M. Jones
rjones at redhat.com
Fri Mar 29 12:49:31 UTC 2019
On Thu, Mar 28, 2019 at 05:59:29PM +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 }
ACK
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
More information about the Libguestfs
mailing list