Killing children

Laura Conrad lconrad at laymusic.org
Fri Aug 6 22:03:37 CEST 2004


>>>>> "Stefan" == Stefan Eischet <stefan at eischet.com> writes:

    Stefan> Hi Laura,
    Stefan> what a terrible subject line! ;-)

I used to think that when I first started using UNIX in the mid 80's.
But I am now a hardened child-killer.

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

I don't see that it really saves me much over using the cygwin kill
command.

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

Yes, that's one of the things I'm worried about.

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

I'm attaching the test program.  With the commented out call to spawn
loop.py, it seems to work fine, both on linux and on cygwin.  When I
call the actual program, which reads and writes the serial port and
writes into a postgresql database, as well as to stdout, it doesn't
look like it's invoking the program at all on cygwin.  (loop.py just
writes the date to sdout every 5 seconds.)

The process it spawns doesn't appear on the ps, and no data gets put
in the database or written to stdout.  When it tries to kill the
process it's spawned, I get an error message: "kill 2348: Operation not
permitted", which is different from the message I get if I just kill a
process that doesn't exist, so something is happening, but it isn't
what I want.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testspawn.py
Type: text/x-python
Size: 253 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040806/00757a80/attachment.py>
-------------- next part --------------


-- 
Laura (mailto:lconrad at laymusic.org , http://www.laymusic.org/ )
(617) 661-8097	fax: (501) 641-5011
233 Broadway, Cambridge, MA 02139




More information about the Python-list mailing list