diff scgi.t @ 960:d4a0232425ee

Tests: fixed race in SCGI tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 24 Jun 2016 16:30:08 +0300
parents e9064d691790
children 882267679006
line wrap: on
line diff
--- a/scgi.t
+++ b/scgi.t
@@ -64,7 +64,7 @@ http {
 EOF
 
 $t->run_daemon(\&scgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:' . port(1));
 
 ###############################################################################
 
@@ -126,8 +126,10 @@ sub scgi_daemon {
 	my $count = 0;
 
 	while (my $request = $scgi->accept()) {
+		eval { $request->read_env(); };
+		next if $@;
+
 		$count++;
-		$request->read_env();
 
 		$request->connection()->print(<<EOF);
 Location: http://localhost/redirect