dougm 02/04/06 20:36:52
Modified: perl-framework/Apache-Test/lib/Apache TestServer.pm
Log:
re-enable SIGCHLD / $? status checking for linux only
Revision Changes Path
1.57 +25 -17
httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm
Index: TestServer.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- TestServer.pm 7 Apr 2002 02:14:40 -0000 1.56
+++ TestServer.pm 7 Apr 2002 04:36:52 -0000 1.57
@@ -378,6 +378,9 @@
error "@_ ($log_file_info)";
}
+#this doesn't work well on solaris or hpux at the moment
+use constant USE_SIGCHLD => $^O eq 'linux';
+
sub start {
my $self = shift;
my $old_pid = $self->stop;
@@ -416,28 +419,33 @@
$config->{win32obj} = $obj;
}
else {
- # XXX: try not to be POSIX dependent
-# require POSIX;
$old_sig = $SIG{CHLD};
-#XXX: this is not working well on solaris or hpux
-# $SIG{CHLD} = sub {
-# while ((my $child = waitpid(-1, POSIX::WNOHANG())) > 0) {
-# my $status = $? >> 8;
-# #error "got child exit $status";
-# if ($status) {
-# $self->failed_msg("\nserver has died with status
$status");
-# kill SIGTERM => $$;
-# }
-# }
-# };
+
+ if (USE_SIGCHLD) {
+ # XXX: try not to be POSIX dependent
+ require POSIX;
+
+ #XXX: this is not working well on solaris or hpux
+ $SIG{CHLD} = sub {
+ while ((my $child = waitpid(-1, POSIX::WNOHANG())) > 0) {
+ my $status = $? >> 8;
+ #error "got child exit $status";
+ if ($status) {
+ my $msg = "server has died with status $status";
+ $self->failed_msg("\n$msg");
+ kill SIGTERM => $$;
+ }
+ }
+ };
+ }
defined(my $pid = fork) or die "Can't fork: $!";
unless ($pid) { # child
my $status = system "$cmd";
-# if ($status) {
-# $status = $? >> 8;
-# #error "httpd didn't start! $status";
-# }
+ if ($status) {
+ $status = $? >> 8;
+ #error "httpd didn't start! $status";
+ }
CORE::exit $status;
}
}