how to kill subprocess when Python process is killed?
wuwei23 at gmail.com
Fri Aug 7 07:57:34 CEST 2009
On Aug 7, 3:42 pm, "mark.v.we... at gmail.com" <mark.v.we... at gmail.com>
> When I kill the main process (cntl-C) the subprocess keeps running.
> How do I kill the subprocess too? The subprocess is likey to run a
> long time.
You can register functions to run when the Python process ends by
using the atexit module.
The following has been tested & works under Python 2.6 on Windows XP:
print 'stop the subprocess in here'
More information about the Python-list