about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-09-17 08:41:23 +0000
committerEric Wong <e@80x24.org>2019-09-17 08:41:23 +0000
commitb93664a04b041260b4e46aeeb92a521e7abd7c75 (patch)
treedc9552ff230e164af0760662cacf00dd4c5c1b50
parentd2bbf647026a889700d9a62f79ef0875ca41b39a (diff)
downloadpublic-inbox-b93664a04b041260b4e46aeeb92a521e7abd7c75.tar.gz
We don't want the stdin from the test runner to accidentally
cause this test to fail.
-rw-r--r--t/httpd-corner.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index f5937e76..c6f78dde 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -31,6 +31,10 @@ my $httpd = 'blib/script/public-inbox-httpd';
 my $psgi = "./t/httpd-corner.psgi";
 my $sock = tcp_server();
 
+# make sure stdin is not a pipe for lsof test to check for leaking pipes
+open(my $null, '<', '/dev/null') or die 'no /dev/null: $!';
+my $rdr = { 0 => fileno($null) };
+
 # Make sure we don't clobber socket options set by systemd or similar
 # using socket activation:
 my ($defer_accept_val, $accf_arg);
@@ -57,7 +61,7 @@ END { kill 'TERM', $pid if defined $pid };
 my $spawn_httpd = sub {
         my (@args) = @_;
         my $cmd = [ $httpd, @args, "--stdout=$out", "--stderr=$err", $psgi ];
-        $pid = spawn_listener(undef, $cmd, [ $sock, $unix ]);
+        $pid = spawn_listener(undef, $cmd, [ $sock, $unix ], $rdr);
         ok(defined $pid, 'forked httpd process successfully');
 };