[Libguestfs] [PATCH v2 4/5] tools: Add machine_output function.

Pino Toscano ptoscano at redhat.com
Tue Mar 20 10:58:14 UTC 2018


On Friday, 16 March 2018 14:30:42 CET Richard W.M. Jones wrote:
> Produces machine-readable output delimited by special markers
> __MACHINEBEGIN__
> __MACHINEEND__
> ---

While I like the idea of machine readable output (with a standard
format even), I'm not sure about this way of printing it together
with non-machine readable stuff such as debug and trace.

The problem is that the debug output goes to stdout, and the trace
to stderr, so v2v users would need to "drain" either of them to get
the machine readable markers, then drain until the end marker, and so
on to the next marker (until the end of the execution).

IMHO a better idea is to send the machine readable stuff to something
else, e.g. using
  --machine-readable-output FILE
  --machine-readable-FD FD
This way, v2v users will just get the right data with no need to filter
anything else.  The same mechanism can be extended to --print-source,
and to the status/progress output (avoiding the need to parse even
shell colors).

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180320/9860a381/attachment.sig>


More information about the Libguestfs mailing list