How To Catch “Kill” Events with Python

daniel's devel blog

Currently I’m working on a small MRCPv2 client written in Python, which is part of a bigger project at my laboratory. The client is started remotely by a program which controls and monitors several applications in the whole network and is stopped by it again.

In the Linux world catching “kill events” would be a simple task, to shut down another program a process just has to send a SIGTERM signal which can be caught be Python easily using the signal module which comes with every Python installation. However, on Windows things are a little bit harder, because the operating system never produces SIGTERM (and SIGILL) events according to the signal.h documentation from MSDN. That’s why it took me some time to figure out how to catch “kill” events under Windows with Python.

First of all, there are two different ways to close a program in Windows using the .NET…

View original post 87 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s