chiark / gitweb /
cgi-fcgi-interp: Test program does more useful things
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 29 Mar 2016 20:20:20 +0000 (21:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 29 Mar 2016 20:20:20 +0000 (21:20 +0100)
cprogs/cgi-fcgi-test

index 5abfe9a..48dfbdc 100755 (executable)
@@ -4,11 +4,22 @@
 use warnings;
 use strict;
 
+BEGIN {
+    open REALSTDERR, ">&2";
+}
+
+$SIG{'TERM'} = sub {
+    eval { print REALSTDERR "[real-stderr] closing\n"; };
+    exit 15;
+};
+
 use FCGI;
 
 my $count = 0;
 my $request = FCGI::Request();
 
+warn;
+
 while ($request->Accept >= 0) {
     print <<END;
 Content-Type; text/plain
@@ -16,5 +27,7 @@ Content-Type; text/plain
 success
 count=$count
 END
+    print STDERR "[stderr] serviced $count.\n";
+    print REALSTDERR "[real-stderr] serviced $count.\n";
     $count++;
 }