- my $pid = delete $self->{pid};
- delete $self->{in};
- return unless $pid;
- eval {
- PublicInbox::DS::dwaitpid($pid, undef, undef);
- $self->close; # we're still in the event loop
- };
- if ($@) { # wait synchronously if not in event loop
- my $sock = delete $self->{sock};
- close $sock if $sock;
- waitpid($pid, 0);
- }