-sub do_waitpid ($) {
- my ($self) = @_;
- my $pid = $self->{pid};
- # PublicInbox::DS may not be loaded
- eval { PublicInbox::DS::dwaitpid($pid, \&waitpid_err, $self) };
- # done if we're running in PublicInbox::DS::EventLoop
- if ($@) {
- # non public-inbox-{httpd,nntpd} callers may block:
- my $ret = waitpid($pid, 0);
- waitpid_err($self, $ret);
+ my ($env, $qx_cb, $qx_arg, $qx_buf) =
+ delete @$self{qw(psgi_env qx_cb qx_arg qx_buf)};
+ if ($qx_cb) {
+ eval { $qx_cb->($qx_buf, $qx_arg) };
+ return unless $@;
+ warn "E: $@"; # hope qspawn.wcb can handle it
+ }
+ return if $self->{passed}; # another command chained it
+ if (my $wcb = delete $env->{'qspawn.wcb'}) {
+ # have we started writing, yet?
+ my $code = delete $env->{'qspawn.fallback'} // 500;
+ require PublicInbox::WwwStatic;
+ $wcb->(PublicInbox::WwwStatic::r($code));