]> Sergey Matveev's repositories - public-inbox.git/commitdiff
qspawn: fix process finalization for generic PSGI server
authorEric Wong <e@80x24.org>
Mon, 2 Jan 2023 08:20:13 +0000 (08:20 +0000)
committerEric Wong <e@80x24.org>
Mon, 2 Jan 2023 09:02:51 +0000 (09:02 +0000)
This fixes the inability to fallback to WwwCoderepo on cgit 404s
with generic PSGI servers.  Unfortunately, this doesn't seem to
get tested with generic PSGI tests, and doesn't happen on
public-inbox-httpd, obviously.

lib/PublicInbox/Qspawn.pm

index 9ca6b3dbbcc98c6a761e34fe4cc7e94f4a94ccd4..297a284fd4c47deb224f9f7bbc01640fc9d91c31 100644 (file)
@@ -233,9 +233,10 @@ sub psgi_return_init_cb {
        if (ref($r) ne 'ARRAY' || scalar(@$r) == 3) { # error
                if ($async) { # calls rpipe->close && ->event_step
                        $async->close; # PublicInbox::HTTPD::Async::close
-               } else {
-                       $self->{rpipe}->close;
+               } else { # generic PSGI:
+                       delete($self->{rpipe})->close;
                        event_step($self);
+                       waitpid_err($self);
                }
                if (ref($r) eq 'ARRAY') { # error
                        $wcb->($r)