[Lazarus] Finding out how a program's being terminated

Henry Vermaak henry.vermaak at gmail.com
Sun Feb 17 00:55:09 CET 2013


On Sat, Feb 16, 2013 at 06:43:51PM +0100, Michael Van Canneyt wrote:
> On Sat, 16 Feb 2013, waldo kitty wrote:
> >On 2/16/2013 08:30, Hans-Peter Diettrich wrote:
> >>Procedures even may be different for Linux and Windows, depending on the
> >>signal/message types. Even if a program can ignore SIGTERM, can
> >>it also inform
> >>the system that it doesn't *want* to close? On Windows a program
> >>can stop an
> >>shutdown, maybe not on other platforms.
> >
> >i have exactly this problem to deal with on *nix... my app needs
> >to be allowed to complete its shutdown closeout procedures or
> >there are problems on the next boot when it is started up... on
> >shutdown, app managed data is removed from a living data file to
> >another file for restoration on startup... this takes longer than
> >5 seconds and it hurts at times when the system sigkills the app
> >:/
> 
> Why not just rename the file and do the cleanup on startup ?

Some editors do it like this, e.g. if I edit a file in vim and then kill
it from another terminal:

hcv at hcv-q45:~$ vim test.txt
Vim: Caught deadly signal TERM
Vim: preserving files...
Vim: Finished.

The next time I try to edit that file, it asks me if I want to recover
it.  This has saved me more than once :)

Henry




More information about the Lazarus mailing list