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

Function code breaking out of if then ...fi



Hello,
I wonder if the following behaviour is a bug, or
simply my wrong expectation:

This script, assuming the globbing fails, and I'm not using NULL_GLOB,
does not bother finishing the commands in the "then ....fi" block,
instead continues after "fi".


#! /usr/bin/zsh -feu

fn () {
    foreach sum (non-existing*) {echo $sum}
}

if true;
then
    fn
    exit 0
fi

echo tragedy
exit -1


---------------------------

I was advised (on IRC) to use

{ fn } always { TRY_BLOCK_ERROR=0 }


But I'd like to see the behaviour documented in
the chapters not about " {} always {} ".
Thank you


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