about summary refs log tree commit homepage
path: root/lib/PublicInbox/TestCommon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-02-12 03:12:03 +0000
committerEric Wong <e@80x24.org>2023-02-12 23:19:47 +0000
commitee8746e6db4dbe5a6cdb0d6080f467bc27693b3a (patch)
tree4e4bf24279a75b309665d55655d9f552e53da66e /lib/PublicInbox/TestCommon.pm
parent69eb1cbf5fed2a311b5692b09a8d074745fe63ac (diff)
downloadpublic-inbox-ee8746e6db4dbe5a6cdb0d6080f467bc27693b3a.tar.gz
While we can't waitpid() on daemonized process, we can abuse the
lack of FD_CLOEXEC to detect a process death.  This saves
roughly 400ms for this slow test.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r--lib/PublicInbox/TestCommon.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 1fe7931e..8a34e45a 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -480,6 +480,9 @@ sub start_script {
         my $pid = fork // die "fork: $!\n";
         if ($pid == 0) {
                 eval { PublicInbox::DS->Reset };
+                for (@{delete($opt->{-CLOFORK}) // []}) {
+                        close($_) or die "close $!";
+                }
                 # pretend to be systemd (cf. sd_listen_fds(3))
                 # 3 == SD_LISTEN_FDS_START
                 my $fd;