]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
ds: use WNOHANG with waitpid if inside event loop
[public-inbox.git] / lib / PublicInbox / Git.pm
index f5c7a95c34d7aedad7860a1189f8e121167eb1fb..2f1a61f97f5e1da13efac6e3c36b3760390fb30d 100644 (file)
@@ -198,7 +198,10 @@ sub _destroy {
        my $p = delete $self->{$pid} or return;
        delete @$self{($in, $out)};
        delete $self->{$err} if $err; # `err_c'
-       waitpid $p, 0;
+
+       # PublicInbox::DS may not be loaded
+       eval { PublicInbox::DS::dwaitpid($p, undef, undef) };
+       waitpid($p, 0) if $@; # wait synchronously if not in event loop
 }
 
 sub fail {