Sublime Forum

on_close EventListener

#1

I have a developed a plugin for the statistical software Stata (called StataEditor). To send code to Stata, I use the Pywin32 module to create an automation object and launch Stata. If I close ST, this object lives on for approximately 5 minutes and then dies (causing Stata to close without warning). To get around this problem, I would like to display a warning text, and ideally ask the user whether s/he really wants to close ST. However, as far as I can tell, Sublime Text’s on_close EventListener only works for a given view and not for ST itself. My question is therefore if there is a way to recognize when ST is closing?

0 Likes

#2

There is no way within ST itself to detect when ST is closing.

You must spawn another process that periodically checks whether the ST process is still running.

FWIW, I don’t think on_close gets called when a project is closed either. This is different in that ST does not close if there is another project still open and could potentially ruin your setup.

0 Likes

#3

Thanks a lot for your reply, I’ll have to think of another way to do it then.

0 Likes