changeset 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 8d2c6358d830
children f9325406df0b
files lib/Test/Nginx.pm
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -210,9 +210,9 @@ sub stop() {
 		my @globals = $self->{_test_globals} ?
 			() : ('-g', "pid $testdir/nginx.pid; "
 			. "error_log $testdir/error.log debug;");
-		exec($NGINX, '-c', "$testdir/nginx.conf", '-s', 'stop',
-			@globals)
-			or die "Unable to exec(): $!\n";
+		system($NGINX, '-c', "$testdir/nginx.conf", '-s', 'stop',
+			@globals) == 0
+			or die "system() failed: $?\n";
 
 	} else {
 		kill 'QUIT', `cat $self->{_testdir}/nginx.pid`;
@@ -230,7 +230,7 @@ sub stop_daemons() {
 
 	while ($self->{_daemons} && scalar @{$self->{_daemons}}) {
 		my $p = shift @{$self->{_daemons}};
-		kill 'TERM', $p;
+		kill $^O eq 'MSWin32' ? 9 : 'TERM', $p;
 		wait;
 	}