help / color / mirror / code / Atom feed
* Use of { try-list } always { always-list } with "set e-"
@ 2021-07-17 13:03 Zach Riggle
  2021-07-17 20:07 ` Eric Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Zach Riggle @ 2021-07-17 13:03 UTC (permalink / raw)
  To: zsh-users

Hello all!

I'm trying to use the "always" keyword to ensure that some cleanup
happens, even if an error occurs.

Perhaps I'm misunderstanding the intent of this feature, but it seems
that the always-list should be executed, even with "set -e".

set -e
() {
        echo TRY
    } always {
        echo ALWAYS

I know that the always-list is executed if there's a "return" or
"exit" statement in the try-list, but I was hoping to be able to put
in some cleanup in the always-list in the event of an error.

Is there any way to achieve what I'm looking to do?

Zach Riggle

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-17 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 13:03 Use of { try-list } always { always-list } with "set e-" Zach Riggle
2021-07-17 20:07 ` Eric Cook

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).