lib/PublicInbox/LEI.pm | 11 +++++++++++ lib/PublicInbox/LeiXSearch.pm | 7 ++++++- script/lei | 8 +++++--- diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index c36456989449e31739945c3ca5b8b073ca09a6f8..e95a674b16f59c30d4a29713c4d8e50150dce120 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -746,6 +746,17 @@ syswrite($self->{au_done}, 'q' x ($self->{lxs}->{jobs} // 0)); } } +sub poke_mua { # forces terminal MUAs to wake up and hopefully notice new mail + my ($self) = @_; + return unless $self->{opt}->{mua} && -t $self->{1}; + # hit the process group that started the MUA + if (my $s = $self->{sock}) { + send($s, '-WINCH', MSG_EOR); + } elsif ($self->{oneshot}) { + kill('-WINCH', $$); + } +} + # caller needs to "-t $self->{1}" to check if tty sub start_pager { my ($self) = @_; diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index 588df3a4b9db9934f1a7b075527bf0d40c1eff28..10485220a359976ebe6f88fad2ab3ce91c69eff0 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -317,7 +317,12 @@ } $lei->{1} = $out; } - $l2m->lock_free ? $l2m->poke_dst : $lei->start_mua; + if ($l2m->lock_free) { + $l2m->poke_dst; + $lei->poke_mua; + } else { # mbox users + $lei->start_mua; + } } $lei->{-progress} and $lei->err('# ', $lei->{-mset_total} // 0, " matches"); diff --git a/script/lei b/script/lei index b7f21f1410fab4237054542cd2cdfbec72b0f8c1..0b0e2976435593d73dcd97a3cacce432679ddba6 100755 --- a/script/lei +++ b/script/lei @@ -105,13 +105,15 @@ last if $!{ECONNRESET}; die "recvmsg: $!"; } last if $buf eq ''; - if ($buf =~ /\Ax_it ([0-9]+)\z/) { + if ($buf =~ /\Aexec (.+)\z/) { + $exec_cmd->(\@fds, split(/\0/, $1)); + } elsif ($buf eq '-WINCH') { + kill($buf, $$); # for MUA + } elsif ($buf =~ /\Ax_it ([0-9]+)\z/) { $x_it_code = $1 + 0; last; } elsif ($buf =~ /\Achild_error ([0-9]+)\z/) { $x_it_code = $1 + 0; - } elsif ($buf =~ /\Aexec (.+)\z/) { - $exec_cmd->(\@fds, split(/\0/, $1)); } else { $sigchld->(); die $buf;