# HG changeset patch # User Maxim Dounin # Date 1370661151 -14400 # Node ID a113f4d55b129c94e674a2746ec1ab6936aa3dfb # Parent 6fe0459b6668b258b6bce86dcab958b57a2696ce Tests: fix hang on exit after errors in child processes. The f781b087b7aa moved test directory removal from File::Temp, where it was protected by a pid check, into Test::Nginx destructor. As a result destruction triggered due to a child process death now removes temp directory, thus preventing main process from stopping nginx as it no longer able to read nginx.pid. Fix is to protect destructor with pid check. diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -35,6 +35,8 @@ sub new { my $self = {}; bless $self; + $self->{_pid} = $$; + $self->{_testdir} = tempdir( 'nginx-test-XXXXXXXXXX', TMPDIR => 1 @@ -47,6 +49,7 @@ sub new { sub DESTROY { my ($self) = @_; + return if $self->{_pid} != $$; $self->stop(); $self->stop_daemons(); if ($ENV{TEST_NGINX_CATLOG}) {