qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v4 2/4] docker: Fix exit code if $CMD failed


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v4 2/4] docker: Fix exit code if $CMD failed
Date: Mon, 11 Jul 2016 06:58:09 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 07/10/2016 09:20 PM, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  tests/docker/run | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/docker/run b/tests/docker/run
> index 575e732..38ce789 100755
> --- a/tests/docker/run
> +++ b/tests/docker/run
> @@ -11,6 +11,8 @@
>  # or (at your option) any later version. See the COPYING file in
>  # the top-level directory.
>  
> +set -e
> +

'set -e' is a crutch that often does not do what you naively expect. In
particular, it interacts very poorly with shell functions; if 'f' is a
shell function, running 'f' is different than running 'f || alternate',
in whether the body of 'f' will exit early.  I'd much rather script
without having to think about whether 'set -e' is doing the right thing,
because it usually isn't.

>  if test -n "$V"; then
>      set -x
>  fi
> @@ -61,4 +63,6 @@ elif test -n "$DEBUG"; then
>      echo
>      # Force error after shell exits
>      $SHELL && exit 1
> +else
> +    exit 1
>  fi
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]