]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / Git.pm
index fdfe126932038fba455ef09e7a9789a8f0796b60..49c0d5d60760c7c3d0a7c2149df22fc4c53811bc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
 # License: GPLv2 or later <https://www.gnu.org/licenses/gpl-2.0.txt>
 #
 # Used to read files from a git repository without excessive forking.
@@ -126,6 +126,7 @@ sub _bidi_pipe {
        }
        my ($in_r, $p) = popen_rd(\@cmd, undef, $redir);
        $self->{$pid} = $p;
+       $self->{"$pid.owner"} = $$;
        $out_w->autoflush(1);
        if ($^O eq 'linux') { # 1031: F_SETPIPE_SZ
                fcntl($out_w, 1031, 4096);
@@ -327,7 +328,7 @@ sub _destroy {
 
        # GitAsyncCat::event_step may delete {pid}
        my $p = delete $self->{$pid} or return;
-       dwaitpid $p;
+       dwaitpid($p) if $$ == $self->{"$pid.owner"};
 }
 
 sub cat_async_abort ($) {