trapping signals in Apache::Test script to reap forks
am 19.12.2008 23:14:00 von Mark HedgesHi. I'm using Apache::Test to develop tests for my OpenID
in-line session-based auth for the upcoming production
release of Apache2::Controller.
In order to do this I have to run a Net::OpenID::Server via
an HTTP::Server::Simple which forks the test script and runs
the test OpenID server into the background.
Trouble is, if I encounter some kind of error in the test
libraries themselves, like use of an uninitialized value
under warnings FATAL => all, or if hit ctl-c while running
the test, the forked child doesn't die, but remains in the
background consuming memory and the temporary port that was
assigned.
I thought maybe I could use sigtrap in the test script and
kill the pid of the child HTTP::Server::Simple. But it
doesn't seem to work. Is this because t/TEST doesn't pass
the signal on to the interpreter of the individual script?
Any idea how I could do this so the forked child of the
openid.t script will always exit cleanly on an error
condition?
Thanks.
Mark