comparison lib/Test/Nginx.pm @ 415:020c4e47ecac

Tests: revert 068d020a8f85 and localize $? instead. The problem observed was due to $? being overwritten in the destructor after it has been set by exit(), specifically by waitpid() in stop_daemons(). Fix is to localize $? in the destructor to make sure it won't be accidentally changed.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 20 Jun 2014 21:01:52 +0400
parents 17c5a1cc8757
children 60888e2c3f5a
comparison
equal deleted inserted replaced
414:068d020a8f85 415:020c4e47ecac
49 return $self; 49 return $self;
50 } 50 }
51 51
52 sub DESTROY { 52 sub DESTROY {
53 my ($self) = @_; 53 my ($self) = @_;
54 local $?;
55
54 return if $self->{_pid} != $$; 56 return if $self->{_pid} != $$;
57
55 $self->stop(); 58 $self->stop();
56 $self->stop_daemons(); 59 $self->stop_daemons();
60
57 if ($ENV{TEST_NGINX_CATLOG}) { 61 if ($ENV{TEST_NGINX_CATLOG}) {
58 system("cat $self->{_testdir}/error.log"); 62 system("cat $self->{_testdir}/error.log");
59 } 63 }
60 if (not $ENV{TEST_NGINX_LEAVE}) { 64 if (not $ENV{TEST_NGINX_LEAVE}) {
61 eval { rmtree($self->{_testdir}); }; 65 eval { rmtree($self->{_testdir}); };