From 95de492d3ca723fe81ec3bd23d89b643ce98823e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 Nov 2023 09:21:42 +0000 Subject: lei: fix idempotent STDERR redirect in workers This is needed to support forking from already-forked lei workers and $lei->{2} is already STDERR. Fixes: e015c3742f91 (lei: use autodie where appropriate, 2023-10-17) --- lib/PublicInbox/LEI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/LEI.pm') diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 460aed40..8d235b37 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -581,7 +581,7 @@ sub _lei_atfork_child { close($_) for (grep(defined, delete @$self{qw(0 1 2 sock)})); delete $cfg->{-lei_store}; } else { # worker, Net::NNTP (Net::Cmd) uses STDERR directly - open STDERR, '+>&', $self->{2}; + open STDERR, '+>&='.fileno($self->{2}); # idempotent w/ fileno STDERR->autoflush(1); $self->{2} = \*STDERR; POSIX::setpgid(0, $$) // die "setpgid(0, $$): $!"; -- cgit v1.2.3-24-ge0c7