I notice that running tests via nmake test, t/TEST or t/SMOKE leaves a httpd.pid file behind in t/logs after the server has stopped. Is this supposed to happen? I thought Apache normally deleted the httpd.pid file when it is stopped.

I also find that if there is such a httpd.pid file in place from some previous run then t/SMOKE generates an error on my Windows machine because it tries to `cat ...` the file to get the PID to kill, and "cat" isn't available on Windows (unless Cygwin tools or similar are in the PATH), e.g.:

=====
C:\Temp\modperl-2.0>perl t/SMOKE modperl\post_utf8 -iterations=1 times=1
*** Using random number seed: 956513680 (autogenerated)
'cat' is not recognized as an internal or external command,
operable program or batch file.
***
------------------------------------------------------------
*** [001-00-00] trying all tests 10 times
[...]
=====

(t/TEST doesn't do this `cat`, and "nmake test" runs a t/TEST -clean first to delete the entire t/logs folder so it doesn't try a `cat` either.)

The attached patch removes the use of "cat" to read any existing httpd.pid file.

But I still have a problem with the httpd.pid file being left behind in the first place. Windows OS's are terrible for re-using the same PID's over and over again within a short space of time, so if a PID file has been left behind from an Apache that has long since stopped then we don't want the next t/SMOKE trying to kill that PID because there's a good chance that it now relates to some other process entirely!

That PID file definitely needs to be cleaned up properly when the Apache used for the tests shuts down. The kill_proc() function that I've just supplied a patch for should only be trying to kill anything on the rare occasions that an Apache actually is still running!

- Steve
--- TestSmoke.pm.orig   2003-09-12 03:47:42.000000000 +0100
+++ TestSmoke.pm        2003-10-09 10:25:37.716887100 +0100
@@ -746,8 +746,9 @@
     my $file = catfile $t_logs, "httpd.pid";
     return unless -f $file;
 
-    my $pid = `cat $file`;
-    chomp $pid;
+    open my $fh, '<', $file or return;
+    chomp(my $pid = <$fh>);
+    close $fh or return;
     return unless $pid;
 
     kill SIGINT => $pid;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to