+sub xchg_stderr {
+ my ($self) = @_;
+ _tail_err($self) if $self->{-err_wr};
+ my $dir = $self->{priv_eidx}->{topdir};
+ return unless -e $dir;
+ my $old = delete $self->{-tmp_err};
+ my $pfx = POSIX::strftime('%Y%m%d%H%M%S', gmtime(time));
+ my $err = File::Temp->new(TEMPLATE => "$pfx.$$.lei_storeXXXX",
+ SUFFIX => '.err', DIR => $dir);
+ open STDERR, '>>', $err->filename or die "dup2: $!";
+ STDERR->autoflush(1); # shared with shard subprocesses
+ $self->{-tmp_err} = $err; # separate file description for RO access
+ undef;
+}
+