[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.352,1.353
Tim Peters
tim.one@home.com
Fri, 1 Feb 2002 16:29:38 -0500
[MAL]
> I'm no Win32 expert, just though that the code in the win32process
> module (which is part of win32all) probably already provides code in
> this area.
With a Win32 flavor, which isn't what I need here. There is no distinct
"wait for process" function in Win32, it's just another application of the
very cool WaitFor{Single,Multiple}Object(s)[Ex] APIs (which can "wait" for
sets of "handles" to "do something": kinda like Unix select(), except not
braindead <wink>).
That's fine, but what I specifically needed (for a Zope Corp project) was a
Unixish waitpid() workalike. MS already did most of the work for that in
their _cwait function, so it would be silly not to reuse it. BTW, a google
search suggested Borland also supports a cwait function, but I have neither
a Borland compiler nor time to worry about that platform. You didn't worry
much about the Cray T3E when implementing Unicode either <wink>.
> Another candidate for Windows emulation would be os.kill().
> win32process has TerminateProcess() which could probably be used
> for this (no idea however, how you get from a PID to a process handle
> on Windows).
I'm not looking for random functions to implement; if I *need* an
os.kill()-alike, I'll do one, but I don't expect the need.
TerminateProcess() is a dangerous function on Windows (read the docs). If
you want to risk it, you go from process pid to process handle via the Win32
OpenProcess() function.