Skip to content

Commit

Permalink
clean all filters after all reaping
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Misch committed Mar 10, 2024
1 parent a6f6142 commit f02ec2d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/IPC/Run.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3243,8 +3243,8 @@ sub _cleanup {
## _clobber modifies PIPES
$self->_clobber( $self->{PIPES}->[0] ) while @{ $self->{PIPES} };

# reap kids
for my $kid ( @{ $self->{KIDS} } ) {
_debug "cleaning up kid ", $kid->{NUM} if _debugging_details;
if ( !length $kid->{PID} ) {
_debug 'never ran child ', $kid->{NUM}, ", can't reap"
if _debugging;
Expand All @@ -3256,7 +3256,12 @@ sub _cleanup {
else {
_reap_one($kid, 1);
}
}

# OPS cleanup. Kids may share an OPS object; search for "also to write".
# Example harness: run(['echo',1], '&', ['echo',2], '>', \$out). Hence,
# reap every kid before starting OPS cleanup.
for my $kid ( @{ $self->{KIDS} } ) {
# if ( defined $kid->{DEBUG_FD} ) {
# die;
# @{$kid->{OPS}} = grep
Expand All @@ -3265,7 +3270,7 @@ sub _cleanup {
# $kid->{DEBUG_FD} = undef;
# }

_debug "cleaning up filters" if _debugging_details;
_debug "cleaning up filters at kid ", $kid->{NUM} if _debugging_details;
for my $op ( @{ $kid->{OPS} } ) {
@{ $op->{FILTERS} } = grep {
my $filter = $_;
Expand Down

0 comments on commit f02ec2d

Please sign in to comment.