Win32 CreateProcess with In/out Redirection and a Way to kill the job?

Michael Jonas mj at muc.das-werk.de
Thu Feb 1 18:50:33 CET 2001


Seems like I need people with win32 geek factor....

What I want:
I'd like to code a extension module with a function popen3 (same as in os)
and a function is_alive() and terminate().

What I allready have:
a module which has an popen3 method which does exactly the same like the
posixmodule popen3 except that I extracted it to get hold of the process
Handle (from the normally inaccessible dict). The redirection works fine, I
can check if the job is still alive with my new is_alive(<file>). But I'm
really struggling to terminate the job.

Where my proble is:
The CreateProcess in the popen3 not only starts the job specified, it first
starts a cmd.exe which then starts the job. Ergo: the process handle I save
is the handle of the console app. The started app does not care at all if I
do a TerminateProcess on the console. The cmd.exe dies and the started job
stays alive. I tried to find a way to get hold of the Window Handle of the
console, but did not find a way. (The doughter process seems to die if I
close the Console Window. So I thought I could send a WM_Close to the
Window....) Nothing really worked till here...


Any idea how to implement something like this on Win32?!?


Thanks Michel

PS. Please cc the mail also to mj at muc.das-werk.de, cause I'm having trouble
getting the mail from the list.

-----------------------------------------
Michael Jonas
Head of R&D
Das Werk Digitale Bildverarbeitungs GmbH
mail:  mj at muc.das-werk.de
phone: +49(89)368148-700
fax:   +49(89)368148-111
-----------------------------------------





More information about the Python-list mailing list