diff options
Diffstat (limited to 'lib/PublicInbox/ProcessPipe.pm')
-rw-r--r-- | lib/PublicInbox/ProcessPipe.pm | 9 |
1 files changed, 7 insertions, 2 deletions
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; } |