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

Use of { try-list } always { always-list } with "set e-"



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
        false
    } 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




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