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

Re: A serious bug in execution – where to debug?

On Tue, Jul 30, 2019 at 8:16 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> On Tue, 30 Jul 2019 at 20:12, Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > On Tue, Jul 30, 2019 at 7:55 PM Sebastian Gniazdowski
> > <sgniazdowski@xxxxxxxxx> wrote:
> > > Yes, implementation of plugin effects withdrawal (i.e. unloading)
> > > bases on this. I saw that your initialization of the prompt is called
> > > from precmd, where the shadowing isn't active. So (today) I've
> > > implemented: on-demand wrapping of any function call with the
> > > shadowing-enabling code, and then after a single call unwrapping. This
> > > way I'm able to unload your plugin.
> >
> > When you unload plugins, you also remove temporary files and kill
> > background daemons, right?
> >
> > Roman.
> No. I guess that the temp-files removal can be easily added – by
> shadowing mktemp call. I didn't think about killing of the background
> processes. I guess this too can be added, but I suspect that most of
> them will be invisible in $jobtexts, i.e. disowned, so it might get
> hard. Thanks for the suggestions. How are you running the gitstatus
> process in the plugin?

Do you think it's possible to implement clean shutdown and reentrant
initialization for a piece of code as blackbox?

gitstatusd and p10k both have clean shutdown in their public APIs. It
was quite difficult to implement. By using this API you release all
resources and can initialize the plugins once again within the same
shell. However, if you unset internal variables or close file
descriptors, or fail to kill daemons, you are in undefined behavior
land and all bets are off.


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