X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FProcessPipe.pm;h=4f5fc7515c33f91d44e0122d4487fff99dbac6ce;hb=364d2e95439b00a211d007d93c5ba263b56c1ddf;hp=2769e064ca21d1651fbace905a167ba17922802b;hpb=6d3644f5dd7c54fbee33be728f6735e4419cdc0d;p=public-inbox.git diff --git a/lib/PublicInbox/ProcessPipe.pm b/lib/PublicInbox/ProcessPipe.pm index 2769e064..4f5fc751 100644 --- a/lib/PublicInbox/ProcessPipe.pm +++ b/lib/PublicInbox/ProcessPipe.pm @@ -20,8 +20,13 @@ sub CLOSE { my $ret = defined $fh ? close($fh) : ''; my $pid = delete $_[0]->{pid}; if (defined $pid) { - waitpid($pid, 0); - $ret = '' if $?; + # PublicInbox::DS may not be loaded + eval { PublicInbox::DS::dwaitpid($pid, undef, undef) }; + + if ($@) { # ok, not in the event loop, work synchronously + waitpid($pid, 0); + $ret = '' if $?; + } } $ret; }