diff options
author | Eric Wong <e@80x24.org> | 2020-12-31 13:51:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-01-01 05:00:40 +0000 |
commit | fd71b2ab7a8d18c657ec27e15702ab3057419f02 (patch) | |
tree | 1964362f796d83b317d0ce3c3eea9cc6fe7b8363 /lib/PublicInbox/Git.pm | |
parent | c3bdb8f03474d35ec8904f1758c4302159adfa57 (diff) | |
download | public-inbox-fd71b2ab7a8d18c657ec27e15702ab3057419f02.tar.gz |
Objects with DESTROY callbacks get propagated to children, so we must be careful to not invoke waitpid from children on their sibling processes. Only parents (and their parents...) can reap child processes.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r-- | lib/PublicInbox/Git.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index fdfe1269..47928c55 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -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 ($) { |