File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
lib/Test/Class/Moose/Executor Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -116,15 +116,27 @@ sub _run_test_classes_in_parallel {
116
116
}
117
117
118
118
# This chunk of code only runs in child processes
119
+ my $child_pid = $$ ;
120
+
119
121
my $class_report ;
120
122
$subtest -> attach($id );
121
123
$subtest -> run(
122
124
sub {
123
125
$class_report = $self -> run_test_class($test_class );
124
126
}
125
127
);
126
- $subtest -> detach;
127
- $self -> _fork_manager-> finish( 0, \$class_report );
128
+
129
+ # if the test class also creates forks, and one of those forks dies,
130
+ # the dead child ends up running here, and causes subsequent problems
131
+ # with Test2::AsyncSubtest::detach, and can potentially cascade into
132
+ # all kinds of other problems during global destruction. i have no
133
+ # idea how a grandchild death can end up running this code...
134
+ if ($$ == $child_pid ) {
135
+ $subtest -> detach;
136
+ $self -> _fork_manager-> finish( 0, \$class_report );
137
+ } else {
138
+ warn " Ignoring unknown child pid $$ , did a grandchild pid die?" ;
139
+ }
128
140
}
129
141
130
142
$self -> _fork_manager-> wait_all_children;
You can’t perform that action at this time.
0 commit comments