[issue12540] "Restart Shell" command leaves pythonw.exe processes running
Eli Bendersky
report at bugs.python.org
Sat Jul 23 13:14:10 CEST 2011
Eli Bendersky <eliben at gmail.com> added the comment:
According to http://msdn.microsoft.com/en-us/library/7zt1y878%28v=vs.80%29.aspx, on Windows _spawnv in async mode (P_NOWAIT) returns the process _handle_, not the process ID.
win32_kill uses OpenProcess, passing it pid to obtain the handle, but this pid is already the process handle.
Removing the whole call to OpenProcess in win32_kill and passing pid (instead of handle) directly to TerminateProcess, solves the problem.
----
So this appears to be a mismatch between os.spawnv and os.kill on windows. The fist returns the process handle, the second expects a process ID.
Note that the documentation of os.spawnv mentions something about this:
If mode is P_NOWAIT, this function returns the process id of the new process; [...] On Windows, the process id will actually be the process handle, so can be used with the waitpid() function.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12540>
_______________________________________
More information about the Python-bugs-list
mailing list