Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug or Feature? Always block triggered by return in subshell within function
- X-seq: zsh-workers 53617
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: Lawrence Velázquez <larryv@xxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Bug or Feature? Always block triggered by return in subshell within function
- Date: Tue, 13 May 2025 16:01:05 -0700
- Archived-at: <https://zsh.org/workers/53617>
- In-reply-to: <CAGdYchsM7Yd0dcRJ8tz1raFJMQgLJ=Gxg_w=hSwm4fM+zNyACw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchuowr=nk=mdN25p6bUqTFvp=S1Sf6p-JVPjzCcMCEeHfQ@mail.gmail.com> <35ca7ea5-9169-44a3-9846-9d05a192d3a4@app.fastmail.com> <CAGdYchsM7Yd0dcRJ8tz1raFJMQgLJ=Gxg_w=hSwm4fM+zNyACw@mail.gmail.com>
On Sun, May 11, 2025 at 2:38 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> Since their semantics are unspecified, any chance we could bring exit statements in sync (in my opinion the more always block triggered, the better) ?
It would be preferable IMO for "exit" to always exit. If you want the
always block, use "return"; if you want exit action, use TRAPEXIT().
It's possible to write
{ something } always { TRAPEXIT }
if you want the same handling in both cases.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author