From 7893b78fd691ef1e9b503e44174ff53278b02554 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 16 Oct 2021 01:00:58 +0000 Subject: lei: more eval guards for die on failure Relying on $lei->fail is unsustainable since there'll always be parts of our code and dependencies which can trigger die() and break the event loop. --- lib/PublicInbox/LEI.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LEI.pm') diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 0cdcf449..511b2c1d 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -556,7 +556,7 @@ sub _lei_atfork_child { # we need to explicitly close things which are on stack if ($persist) { open $self->{3}, '<', '/' or die "open(/) $!"; - fchdir($self) or die; + fchdir($self); close($_) for (grep(defined, delete @$self{qw(0 1 2 sock)})); if (my $cfg = $self->{cfg}) { delete @$cfg{qw(-lei_store -watches -lei_note_event)}; @@ -779,7 +779,7 @@ sub lazy_cb ($$$) { sub dispatch { my ($self, $cmd, @argv) = @_; - fchdir($self) or return; + fchdir($self); local %ENV = %{$self->{env}}; local $current_lei = $self; # for __WARN__ $self->{2}->autoflush(1); # keep stdout buffered until x_it|DESTROY @@ -1381,7 +1381,7 @@ sub wq_done_wait { # dwaitpid callback sub fchdir { my ($lei) = @_; my $dh = $lei->{3} // die 'BUG: lei->{3} (CWD) gone'; - chdir($dh) || $lei->fail("fchdir: $!"); + chdir($dh) || die "fchdir: $!"; } sub wq_eof { # EOF callback for main daemon -- cgit v1.2.3-24-ge0c7