From: annis at biostat.wisc.edu (William Annis)
Date: 20 Apr 1999 09:45:11 -0500
Subject: Killing popen-generated children
Message-ID: <jtaew3s64o.fsf@wazor.biostat.wisc.edu>
Content-Length: 1223
X-UID: 553                                                  

        Is there any convenient way to get the PID of a process
created via os.popen?  I've written a little GUI tool which takes
the output of some program and shoves it into a Text widget.
(Yes, I know that's a little silly, but it's sometimes useful in the
context of larger systems.)

        The GUI works via a filehandler, which means that a program
like 'ping -s somehost' (Solaris) will keep shoving output into the
Text widget... exactly what I want.

        The problem is that for programs that run forever, when you
quit GUI tool, the program you're catching the output of is orphaned,
and keeps running.  Further, any attempt to close the pipe blocks
forever.  This does not happen if you're collecting the output of a
program which quits on it's own ('ls', for example).

        So... I need to send a kill the offending children.  I
suppose I could poke around in one of the Stevens books and
reimplement popen to give me a PID, but I'd rather not if someone else
has found a solution already.  

-- 
William Annis - System Administrator - Biomedical Computing Group
annis at biostat.wisc.edu                       PGP ID:1024/FBF64031
Mi parolas Esperanton - La Internacia Lingvo    www.esperanto.org




