[Libguestfs] [PATCH 1/5] mltools: split helper do_check_exitcode

Pino Toscano
Wed, 16 Jan 2019 14:17:31 -0000

It will be used later in more parts of Tools_utils.

Simple refactoring with no behaviour changes.
---
 common/mltools/tools_utils.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml
index 24641369e..3b1554c5a 100644
--- a/common/mltools/tools_utils.ml
+++ b/common/mltools/tools_utils.ml
@@ -427,7 +427,9 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args
and do_teardown app outfd errfd exitstat    Option.may Unix.close outfd;
   Option.may Unix.close errfd;
-  match exitstat with
+  do_check_exitcode app exitstat
+
+and do_check_exitcode app = function
   | Unix.WEXITED i ->
     i
   | Unix.WSIGNALED i ->
--
2.20.1