While using utime on the destination Maildir is enough for mutt
to eventually notice new mail, "eventually" isn't good enough.
Send a SIGWINCH to wake mutt (and likely other MUAs)
immediately. This is more portable than relying on MUAs to
support inotify or EVFILT_VNODE.
}
}
+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) = @_;
}
$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");
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;