[Http-webtest-commits] HTTP-WebTest/lib/HTTP/WebTest SelfTest.pm,1.2,1.3
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <m_...@us...> - 2002-12-19 23:24:51
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory sc8-pr-cvs1:/tmp/cvs-serv3862/lib/HTTP/WebTest Modified Files: SelfTest.pm Log Message: Play better with Test::Builder and older version of Perl Index: SelfTest.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/SelfTest.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelfTest.pm 12 Dec 2002 21:43:12 -0000 1.2 --- SelfTest.pm 19 Dec 2002 23:24:42 -0000 1.3 *************** *** 385,393 **** my %param = @_; ! # try to start server ! my $daemon = HTTP::Daemon->new(LocalPort => $param{port}, ReuseAddr => 1) or die; ! # fork server to separate process my $pid = fork; die unless defined $pid; --- 385,392 ---- my %param = @_; ! my $daemon = HTTP::Daemon->new(LocalPort => $param{port}, Reuse => 1) or die; ! # create daemon process my $pid = fork; die unless defined $pid; *************** *** 399,402 **** --- 398,407 ---- $DB::inhibit_exit = 0; + # if we are running with Test::Builder do not let it output + # anything for daemon process + if(Test::Builder->can('new')) { + Test::Builder->new->no_ending(1); + } + # set 'we are working' flag my $done = 0; *************** *** 404,411 **** # exit on SIGTERM $SIG{TERM} = sub { $done = 1 }; ! # handle closed connection $SIG{PIPE} = 'IGNORE'; ! # handle requests untill we are killed eval { until($done) { --- 409,416 ---- # exit on SIGTERM $SIG{TERM} = sub { $done = 1 }; ! # handle connections closed by client $SIG{PIPE} = 'IGNORE'; ! # handle requests till process is killed eval { until($done) { *************** *** 415,419 **** my $nfound = select $rbits, '', '', 0.1; ! # if we have connection then handle it if($nfound > 0) { my $connect = $daemon->accept; --- 420,424 ---- my $nfound = select $rbits, '', '', 0.1; ! # handle incoming connections if($nfound > 0) { my $connect = $daemon->accept; *************** *** 425,433 **** } $connect->close; - undef $connect; } } }; ! # in any case try to shutdown daemon correctly $daemon->close; if($@) { die $@ }; --- 430,437 ---- } $connect->close; } } }; ! # in any event try to shutdown daemon nicely $daemon->close; if($@) { die $@ }; |