Killing children

Stefan Eischet stefan at eischet.com
Fri Aug 6 13:51:55 EDT 2004


Hi Laura,

what a terrible subject line! ;-)

I sometimes use os.system with pskill from 
http://www.sysinternals.com/ntw2k/freeware/pskill.shtml - this should 
do what you want.

I do get my pid from some spawn-variant, IIRC. This should be more 
reliable than killing by name or parsing ps output (since you might 
kill the wrong process if there are multiple processes with the same 
name).

What exactly doesn't work with your spawning? Could you post the spawn 
call you're using?

Cheers,
   Stefan

On 06.08.2004, at 19:36, Laura Conrad wrote:

>
> I'm writing an application that has to spawn some processes and then
> kill them later.  It doesn't need to talk or listen to them while
> they're running, but there are stop and start buttons and the stop
> button should stop everything that gets started by the start button.
>
> There are lots of ways to do this on Linux, but this project has to
> run under cygwin.  So far, the only thing I've gotten to work at all
> under cygwin is doing an 'os.system' to start the process and then
> parsing the "ps" output and using os.kill on the processes that ps
> finds.  This is unsatisfactory in a number of ways.
>
> I have been unable to get os.spawnl to start the processes correctly.
> I was using pexpect, which worked fine with test programs, but not
> with the actual processes that need to be spawned.  I did a little bit
> of playing with the "process" module but didn't get it working right.
>
> Does anyone have a better idea?
> -- 
> Laura (mailto:lconrad at laymusic.org , http://www.laymusic.org/ )
> (617) 661-8097	fax: (501) 641-5011
> 233 Broadway, Cambridge, MA 02139
>
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>
>
// stefan at eischet.com //




More information about the Python-list mailing list