> But that doesn't work, because some servers, like httpd, launch in 
> such a way that the parent httpd process ends up with ppid = 1.

Do they provide an interface to get the PID? ISTR that
HTTP::Server::Simple does, for example. In which case...

> Is there any way to automatically kill all the child processes 
> created by a script (and their descendents)? For example, can I
> catch each subprocess creation somehow and record the pid in a
> global array?

I don't know about the collection part, but I always store PIDs to local
*.pid files, the better to be able to clean them up on subsequent runs,
should a test get interrupted. I can also make that the main job of a
t/99-cleanup.t file: walk through the pid dirs and kill anything still
running, then remove any temp directories that they may have been using.
Encapsulating that work into a single test is also nice as you can
simply call that test as part of 'make [dist]clean' :)

-- 
Greg Sabino Mullane g...@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to