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

Re: zmv exits from function




On 2024-01-02 12:24, Bart Schaefer wrote:
When one of those errors is encountered,
whatever it is that the shell is doing, simply stops.  In a script,
this exits the entire script; in an interactive shell, it returns to
the top-level prompt.  In this specific example, there is no "zmv
returns":  it ends, full stop, no return value, nothing back to the
caller.

That's clear, but I had no idea that was the case.  Nothing back?  Sounds inadvisable  but ...

  This is not a "crash", it's a well-defined exit condition.
Right, I'm corrected.  Yes, 'crash' is a sloppy choice of words. I don't doubt zsh 'knows what it's doing' but it has the look of what Elon calls a rapid unscheduled disassembly.
The "always" construct does nothing to the behavior of e.g. zmv, and
does not "memo" anything.  It allows calling code to intercept the
well-defined exit state and clean up.

I think I'd have to see the actual nuts and bolts of it to really understand.  It's not important.  I learned quite a bit. 

Oh, when the devs have a final cut of the new zmv, if it's posted, I'll paste it over my copy here.





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