From 74b5dc0569db5adb4cc931ce3c3b1b50507eb31d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 28 May 2021 09:45:20 +0000 Subject: lei: restore working directory in more places Every tick of the event loop can change the working directory, so we need to restore it for every client if they operate in different directories. This would be easier if we had openat(2) and friends in Perl; but Inline::C is practically required for lei, now. --- lib/PublicInbox/LeiQuery.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiQuery.pm') diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 1999a534..0435a516 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -51,9 +51,7 @@ sub qstr_add { # PublicInbox::InputPipe::consume callback for --stdin my ($self) = @_; # $_[1] = $rbuf if (defined($_[1])) { $_[1] eq '' and return eval { - if (my $dfd = $self->{3}) { - chdir($dfd) or return $self->fail("fchdir: $!"); - } + $self->fchdir or return; $self->{mset_opt}->{q_raw} = $self->{mset_opt}->{qstr}; $self->{lse}->query_approxidate($self->{lse}->git, $self->{mset_opt}->{qstr}); -- cgit v1.2.3-24-ge0c7