Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-12

How to update a running application

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello all,

I write a small systray application which I know, that time to time we will need to change/add/remove something, but this application is started from user's startup and runs until his log off.

When our update process gets newer version of it I need to close that application, exchange its components and start it again.

On windows I solve it using messaging, but on Linux I don't know what is the way to inform application about my wish to terminate it.

How can I solve this problem?

PS: I though about : 1) signal file as flag to close itself
2) UDP connection to systray to inform it

... but both of them seems to me as brute solutions.

Thanks in advance.

Reply by email

Marc Santhoff
to Roland Turcan
Roland Turcan wrote 15 lines
Hello all, I write a small systray application which I know, that time to time we will need to change/add/remove something, but this application is started from user's startup and runs until his log off. When our update process gets newer version of it I need to close that application, exchange its components and start it again. On windows I solve it using messaging, but on Linux I don't know what is the way to inform application about my wish to terminate it. How can I solve this problem? PS: I though about : 1) signal file as flag to close itself

This is the normal way on Unix-like system. Send your program a SIGTERM or SIGUSR1 or so. I'm not really sure if programs compiled with fpc will terminate automatically on SIGTERM but in all cases you can register a signal handler for SIGUSR1 and do from the program whatever you like to to (except setting the users cat on fire maybe ;).

Try:
$ man kill
$ man sigaction

(on FreeBSD, should be similar on Lunix)

HTH,
Marc

Reply by email

Patrick Chevalley
to Marc Santhoff

SIGTERM work but the default action is quiet brutal, equivalent of halt. Look for fpSigAction in the FPC documentation to learn how to call your own function to handle this signal and cleanly close your application.

Reply by email