A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-April/072454.html below:

[Python-Dev] About SSL tests

[Python-Dev] About SSL tests [Python-Dev] About SSL testsEric V. Smith eric+python-dev at trueblade.com
Tue Apr 3 17:34:32 CEST 2007
[sorry if you see 2 copies of this]

Facundo Batista wrote:
> The problem of TerminateProcess is that I need the handle of the
> process.
> 
> I don't like the idea of rely on the private _handle and do:
> 
>   process = subprocess.Popen(...)
>   ...
>   subprocess.TerminateProcess(int(process._handle), -1)
> 
> so, I'll end doing this:
> 
>   process = subprocess.Popen(...)
>   ...
>   handle =ctypes.windll.kernel32.OpenProcess(1, False, process.pid)
>   ctypes.windll.kernel32.TerminateProcess(handle, -1)
>   ctypes.windll.kernel32.CloseHandle(handle)
> 
> Is this ok?

Would it not be better to put a platform-independent version of this 
into subprocess, so that this code doesn't have to be duplicated all 
over the place?  Maybe a method on a Popen object called terminate()? 
That way you wouldn't even need ctypes, since you could look at the 
_handle without feeling bad about it!

Eric.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4