Mercurial > hg > nginx-tests
comparison lib/Test/Nginx.pm @ 222:5b7883daaf82
Tests: use kill(9, $pid) on win32.
Change daemon termination to use kill(9, $pid) on win32, as normally used
kill(TERM, $pid) doesn't work with perlfork emulation and causes process
hangs.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 03 Jun 2012 04:56:14 +0400 |
parents | f6f60780f758 |
children | 4c43b3a0117c |
comparison
equal
deleted
inserted
replaced
221:8d2c6358d830 | 222:5b7883daaf82 |
---|---|
208 if ($^O eq 'MSWin32') { | 208 if ($^O eq 'MSWin32') { |
209 my $testdir = $self->{_testdir}; | 209 my $testdir = $self->{_testdir}; |
210 my @globals = $self->{_test_globals} ? | 210 my @globals = $self->{_test_globals} ? |
211 () : ('-g', "pid $testdir/nginx.pid; " | 211 () : ('-g', "pid $testdir/nginx.pid; " |
212 . "error_log $testdir/error.log debug;"); | 212 . "error_log $testdir/error.log debug;"); |
213 exec($NGINX, '-c', "$testdir/nginx.conf", '-s', 'stop', | 213 system($NGINX, '-c', "$testdir/nginx.conf", '-s', 'stop', |
214 @globals) | 214 @globals) == 0 |
215 or die "Unable to exec(): $!\n"; | 215 or die "system() failed: $?\n"; |
216 | 216 |
217 } else { | 217 } else { |
218 kill 'QUIT', `cat $self->{_testdir}/nginx.pid`; | 218 kill 'QUIT', `cat $self->{_testdir}/nginx.pid`; |
219 } | 219 } |
220 | 220 |
228 sub stop_daemons() { | 228 sub stop_daemons() { |
229 my ($self) = @_; | 229 my ($self) = @_; |
230 | 230 |
231 while ($self->{_daemons} && scalar @{$self->{_daemons}}) { | 231 while ($self->{_daemons} && scalar @{$self->{_daemons}}) { |
232 my $p = shift @{$self->{_daemons}}; | 232 my $p = shift @{$self->{_daemons}}; |
233 kill 'TERM', $p; | 233 kill $^O eq 'MSWin32' ? 9 : 'TERM', $p; |
234 wait; | 234 wait; |
235 } | 235 } |
236 | 236 |
237 return $self; | 237 return $self; |
238 } | 238 } |