]> Sergey Matveev's repositories - public-inbox.git/commitdiff
xapcmd: do not fire END and DESTROY handlers in child
authorEric Wong <e@80x24.org>
Fri, 15 Nov 2019 09:50:41 +0000 (09:50 +0000)
committerEric Wong <e@80x24.org>
Sat, 16 Nov 2019 11:05:23 +0000 (11:05 +0000)
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

index 77f0524e2b9a0fc42d67e935bc9309c735489d8f..2828589889c362fd9550e61d4f5456f20f6a3a10 100644 (file)
@@ -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 ($) {