[python-win32] Killing a subprocess spawned by a service
Patrick Tisdale
patrick.tisdale at gmail.com
Tue Jun 18 23:51:46 CEST 2013
Hello list,
I have written a test script to run as a service. The service starts up
properly, and spawns a subprocess (called test.py) using subprocess.Popen.
However, I am having no luck killing the subprocess when I stop the
service. I am using os.kill()
It works fine when running pythonservice.exe in debug mode. But when I
start it using "net start" the subprocess.Popen.pid matches the "cmd" that
it spawns (due to shell=True, I suppose). I have tried it without
shell=True, but can't get the script to run without it.
The test script is a simple script that periodically writes to a file. The
script that I actually need to make work is a twisted twistd (.tac) file,
which will have multiple TCP connections open, and I need to be able to
close those connections before it exits.
Any ideas on what I'm missing?
Thanks,
Patrick Tisdale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130618/d01e6e68/attachment.html>
More information about the python-win32
mailing list