diff options
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r-- | lib/PublicInbox/LeiQuery.pm | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index a23354f0..e2d8a096 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -59,20 +59,19 @@ sub _start_query { # used by "lei q" and "lei up" $lxs->do_query($self); } +sub do_qry { # do_env cb + my ($lei) = @_; + $lei->{mset_opt}->{q_raw} = $lei->{mset_opt}->{qstr}; + $lei->{lse}->query_approxidate($lei->{lse}->git, + $lei->{mset_opt}->{qstr}); + _start_query($lei); +} + sub qstr_add { # PublicInbox::InputPipe::consume callback for --stdin my ($lei) = @_; # $_[1] = $rbuf $_[1] // $lei->fail("error reading stdin: $!"); return $lei->{mset_opt}->{qstr} .= $_[1] if $_[1] ne ''; - eval { - $lei->fchdir; - local %ENV = %{$lei->{env}}; - local $PublicInbox::LEI::current_lei = $lei; - $lei->{mset_opt}->{q_raw} = $lei->{mset_opt}->{qstr}; - $lei->{lse}->query_approxidate($lei->{lse}->git, - $lei->{mset_opt}->{qstr}); - _start_query($lei); - }; - $lei->fail($@) if $@; + $lei->do_env(\&do_qry); } # make the URI||PublicInbox::{Inbox,ExtSearch} a config-file friendly string |