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

Re: "break" and functions



On Fri, Mar 29, 2024 at 9:28 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I meant specifically the difference in behavior
> between builtin and function

Found it:  52151, Bug: function calls with break in preexec

In exactly this same context, in fact:  Adding nofork tests.  No one
responded, that time.

On Sat, Sep 16, 2023 at 8:08 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> [...] "set -x" shows the function call being made, but it
> immediately stops without executing any commands.
>
> One of these cases has to be wrong:  Either the loop should break
> immediately, so neither the builtin nor the function runs, or the
> function should run and then the loop should break.  Or more
> radically, a break occurring in the argument expansions should just be
> discarded, but that seems wrong too.  I think it's the former:  The
> builtin shouldn't run in this case.

I suspect this comes down to "breaks" being tested at the top of
execpline2(), which is called when entering a function but not when
already committed to running a builtin.




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