From c0365a9fae1a72707fb78249861c80fed582d89b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 29 Jan 2021 12:42:59 +0500 Subject: [PATCH] ipc: move on_destroy scope to inside the eval It saves us a line of code --- lib/PublicInbox/IPC.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index ece0e8b8..d2ff038d 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -119,13 +119,12 @@ sub ipc_worker_spawn { PublicInbox::DS::sig_setmask($sigset); # ensure we properly exit even if warn() dies: my $end = PublicInbox::OnDestroy->new($$, sub { exit(!!$@) }); - my $on_destroy = $self->ipc_atfork_child; eval { + my $on_destroy = $self->ipc_atfork_child; local %SIG = %SIG; ipc_worker_loop($self, $r_req, $w_res); }; die "worker $ident PID:$$ died: $@\n" if $@; - undef $on_destroy; undef $end; # trigger exit } PublicInbox::DS::sig_setmask($sigset) unless $oldset; @@ -336,13 +335,12 @@ sub _wq_worker_start ($$$) { PublicInbox::DS::sig_setmask($oldset); # ensure we properly exit even if warn() dies: my $end = PublicInbox::OnDestroy->new($$, sub { exit(!!$@) }); - my $on_destroy = $self->ipc_atfork_child; eval { + my $on_destroy = $self->ipc_atfork_child; local %SIG = %SIG; wq_worker_loop($self); }; warn "worker $self->{-wq_ident} PID:$$ died: $@" if $@; - undef $on_destroy; undef $end; # trigger exit } else { $self->{-wq_workers}->{$pid} = \undef; -- 2.50.0