httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm
Date Fri, 04 Jan 2002 05:05:23 GMT
stas@apache.org wrote:

> stas        02/01/03 20:48:58
> 
>   Modified:    perl-framework/Apache-Test/lib/Apache TestServer.pm
>   Log:
>   - use explicit fork for spawning httpd, now works with 1.3 and 2.0
>   
>   Revision  Changes    Path
>   1.48      +10 -1     httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm


The only trouble this fix has introduced is that now the forked child 
inherits END blocks from the parent and runs them on exit. So you get 
the output of the core_scan in the middle of the parent print.

As I said earlier httpd-2.0 restarts itself in a way that:

   system "httpd ...";

returns immediately, no matter whether the startup was successful or 
not. But 1.3 doesn't return at all, unless the startup wasn't 
successful. So this fork is needed only for 1.3

Any idea how to disable the END blocks inheritance in the forked child? 
I guess we could silence it, by closing STD*. but in the future we may 
have other END blocks which can be undesired to be run in the forked 
sub-process.


>   Index: TestServer.pm
>   ===================================================================
>   RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
>   retrieving revision 1.47
>   retrieving revision 1.48
>   diff -u -r1.47 -r1.48
>   --- TestServer.pm	31 Dec 2001 10:58:22 -0000	1.47
>   +++ TestServer.pm	4 Jan 2002 04:48:58 -0000	1.48
>   @@ -433,7 +433,16 @@
>                    }
>                }
>            };
>   -        $child_pid = open $child_in_pipe, "|$cmd";
>   +
>   +        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";
>   +            }
>   +            CORE::exit $status;
>   +        }
>        }
>    
>        while ($old_pid and $old_pid == $self->pid) {

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Mime
View raw message