[Python-Dev] About SSL tests

Facundo Batista facundo at taniquetil.com.ar
Tue Apr 3 14:53:20 CEST 2007


Martin v. Löwis wrote:

> On Win32, you also have subprocess.TerminateProcess, if you have the
> subprocess module in the first place.

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?

Thank you!!

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/





More information about the Python-Dev mailing list