[wingide-users] A simple question
Pete
pfein at pobox.com
Fri Aug 31 02:58:59 MDT 2007
On Friday August 31 2007 2:00 am, Virgil Stokes wrote:
> I am using Wing IDE 2.1 and find it very useful. However, one things
> bothers me. Suppose I wish to have a "clean" exit/escape from a program
> that I am running in the IDE --- what Python code/expression do I need
> to have to accomplish this. By "clean" I mean no error messages generated.
On Linux, we set up our apps to catch SIGTERM:
http://dpaste.com/18240/
import signal
def install_signal_handler(self):
"""install a handler for SIGTERM, providing clean shutdown"""
def signal_handler(foo, bar):
sys.stderr.write("Got SIGTERM, shutting down")
self.shutdown()
return signal.signal(signal.SIGTERM, signal_handler)
where self is the object that takes over from your main().
IIRC Wing has a menu that allows sending signals to the debug process. Using
SIGTERM to mean please quit/exit/shutdown is standard UNIX - works with init
scripts, kill/top, etc..
--
Peter Fein || 773-575-0694 || pfein at pobox.com
http://www.pobox.com/~pfein/ || PGP: 0xCCF6AE6B
irc: pfein at freenode.net || jabber: peter.fein at gmail.com
More information about the wingide-users
mailing list