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

Re: PATCH: module cleanup



Sven Wischnowsky wrote:
> And I have a question: the cleanup/finish functions are currently
> *not* called for linked-in modules and for loaded builtins if the
> shell is exited without first unloading the modules. Now, if someone
> writes a module that really needs to cleanup things (e.g. it has some
> kind of write-cache without write-through) this will fail utterly.
> Shouldn't we ensure that these functions are always called? Or was
> there some reason not to do it?

I would guess it was only because to begin with the only job there was
to remove builtins from the table and things like that, so there was
no point.  If they are going to do weird things, it would be sensible
to call those.  On the other hand, I don't know if it's necessarily a
good thing to call both cleanup and finish on every exit.  For
example, zftp tries to do a clean `quit' on an existing connection
when it gets unloaded.  This could be potentially hang the shell
exiting.  We could arrange that one of setup and finish always gets
called, which would presumably have to be the first of the two.  But
none of this is entirely clear to me.  It's certainly neatest to call
the lot on any exit.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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