Enhance the output in machine parseable mode, by outputting all the
messages of OCaml tools as JSON to the machine parseable stream.
Related, although not strictly needed for this (and thus can be split
if requested), is the addition of the fd format for the machine
readable stream.
Changes from v1:
- use Obj.magic to convert int -> Unix.file_descr
- add tests
Pino Toscano (4):
common/mltools: move the code for machine readable up
common/mltools: make sure machine readable output is flushed
common/mltools: allow fd for machine readable output
OCaml tools: output messages into JSON for machine readable
.gitignore | 1 +
common/mltools/Makefile.am | 39 ++++++-
common/mltools/parse_tools_messages_test.py | 118 ++++++++++++++++++++
common/mltools/test-machine-readable.sh | 7 ++
common/mltools/test-tools-messages.sh | 28 +++++
common/mltools/tools_messages_tests.ml | 46 ++++++++
common/mltools/tools_utils-c.c | 51 +++++++++
common/mltools/tools_utils.ml | 89 ++++++++++-----
lib/guestfs.pod | 24 ++++
9 files changed, 371 insertions(+), 32 deletions(-)
create mode 100644 common/mltools/parse_tools_messages_test.py
create mode 100755 common/mltools/test-tools-messages.sh
create mode 100644 common/mltools/tools_messages_tests.ml
--
2.20.1