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

Richard W.M. Jones
Wed, 16 Jan 2019 14:28:33 -0000

On Wed, Jan 16, 2019 at 03:17:31PM +0100, Pino Toscano
wrote:
> 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

The change is fine, but I think it's probably better to call the
function ‘error_<something>’ which is consistent with the functions in
virt-v2v which call error.  Perhaps ‘error_if_signaled_or_stopped’?

But anyway, ACK.

Rich.

>    | Unix.WEXITED i ->
>      i
>    | Unix.WSIGNALED i ->
> --
> 2.20.1
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs@redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org