[Python-Dev] Functionality in subprocess.Popen.terminate()

Eric Pruitt eric.pruitt at gmail.com
Mon Aug 3 20:42:03 CEST 2009


In my GSoC project, I have implemented asnychronous I/O in subprocess.Popen.
Since the read/write operations are asynchronous, the program may have
already exited by the time one calls the asyncread function I have
implemented. While it returns the data just fine, I have come across an
issue with the TerminateProcess function in Windows: if the program has
already exited, when subprocess.Popen.Terminate calls the Windows built-in
"TerminateProcess" function, an "access denied" error will occur. Should I
just make it so that this exception is simply ignored or perform some kind
of check to see if the process exists beforehand? If the latter, I have been
unable to find a way to do so, to my liking at least. The solutions I saw
would require code that seems a bit excessive to me.

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090803/70ce1baa/attachment.htm>


More information about the Python-Dev mailing list