From b05207350b218972fc7614c75b49eaae26f9013a Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Fri, 15 Nov 2019 09:50:41 +0000
Subject: [PATCH] xapcmd: do not fire END and DESTROY handlers in child

We need to bypass whatever Test::More does with END/DESTROY
handlers for use in lon-lived process.  This doesn't affect
any of our normal code since we don't use END/DESTROY for
Xapcmd and its callers.
---
 lib/PublicInbox/Xapcmd.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm
index 77f0524e..28285898 100644
--- a/lib/PublicInbox/Xapcmd.pm
+++ b/lib/PublicInbox/Xapcmd.pm
@@ -9,6 +9,7 @@ use PublicInbox::Search;
 use File::Temp qw(tempdir);
 use File::Path qw(remove_tree);
 use File::Basename qw(dirname);
+use POSIX ();
 
 # support testing with dev versions of Xapian which installs
 # commands with a version number suffix (e.g. "xapian-compact-1.5")
@@ -85,7 +86,7 @@ sub cb_spawn {
 	defined(my $pid = fork) or die "fork: $!";
 	return $pid if $pid > 0;
 	$cb->($args, $opt);
-	exit 0;
+	POSIX::_exit(0);
 }
 
 sub runnable_or_die ($) {
-- 
2.50.0