]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: workers exit after they tell lei-daemon
authorEric Wong <e@80x24.org>
Tue, 3 Oct 2023 06:43:49 +0000 (06:43 +0000)
committerEric Wong <e@80x24.org>
Tue, 3 Oct 2023 10:16:07 +0000 (10:16 +0000)
We don't want workers continuing after their stdout has triggered
EPIPE or some other write error.

This fixes xt/lei-onion-convert.t to ensure the quit_waiter_pipe
is fully-closed at daemon teardown during tests.  Using the
`exit' perlop still ensures OnDestroy callbacks will fire.

lib/PublicInbox/LEI.pm

index 817772f75f872bbdf5dbba4b9f5fc5bd82f1787e..10c08b905f1a92bb010251bc16946cb22fde9069 100644 (file)
@@ -485,6 +485,7 @@ sub x_it ($$) {
        stop_pager($self);
        if ($self->{pkt_op_p}) { # worker => lei-daemon
                $self->{pkt_op_p}->pkt_do('x_it', $code);
+               exit($code >> 8);
        } elsif ($self->{sock}) { # lei->daemon => lei(1) client
                send($self->{sock}, "x_it $code", 0);
        } elsif ($quit == \&CORE::exit) { # an admin (one-shot) command