Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "set -e" handling is broken with zsh 5.3.1 and 5.4.1



On 2017-08-27 01:30:34 +0000, Daniel Shahaf wrote:
> Vincent Lefevre wrote on Sun, 27 Aug 2017 02:50 +0200:
> > ----------------------------------------
> > #!/usr/bin/env zsh
> > 
> > set -e
> > 
> > f()
> > {
> >   [[ -z 1 ]] && false
> > }
> > 
> > if false; then
> >   :
> > else
> >   f
> >   echo Fail 1
> >   echo Fail 2
> >   f
> >   echo Fail 3
> > fi
> > ----------------------------------------
> > 
> > I suppose that cond2-e should die just after f is called, before
> > outputting anything. At least, the behavior is not consistent.
> 
> That's what happens if [[ is changed to [, or put into a subshell.

I also get the expected behavior if I put "true" before the line

  [[ -z 1 ]] && false

or if I remove the

if false; then
  :
else

and the "fi".

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author