From a145f5acf90fff0b146e6e871925950f62fb426a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 Apr 2024 06:49:38 +0000 Subject: treewide: avoid getpid for more ownership checks There are still some places where on_destroy isn't suitable, This gets rid of getpid() calls in most of those cases to reduce syscall costs and cleanup syscall trace output. --- t/spawn.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/spawn.t b/t/spawn.t index 5b17ed38..45517852 100644 --- a/t/spawn.t +++ b/t/spawn.t @@ -6,6 +6,7 @@ use Test::More; use PublicInbox::Spawn qw(which spawn popen_rd run_qx); require PublicInbox::Sigfd; require PublicInbox::DS; +use PublicInbox::OnDestroy; my $rlimit_map = PublicInbox::Spawn->can('rlimit_map'); { my $true = which('true'); @@ -171,7 +172,7 @@ EOF my @arg; my $fh = popen_rd(['cat'], undef, { 0 => $r }, sub { @arg = @_; warn "x=$$\n" }, 'hi'); - my $pid = fork // BAIL_OUT $!; + my $pid = PublicInbox::OnDestroy::fork_tmp; local $SIG{__WARN__} = sub { _exit(1) }; if ($pid == 0) { local $SIG{__DIE__} = sub { _exit(2) }; -- cgit v1.2.3-24-ge0c7