Skip to content

Commit 74c42f5

Browse files
committed
Fix collector tempdir vanishing
1 parent 6837c84 commit 74c42f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Test2/Harness/Collector.pm

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ sub collect {
151151
open(my $stderr, '>&', \*STDERR) or die "Could not clone STDERR";
152152
local $SIG{__WARN__} = sub { print $stderr @_ };
153153

154+
my $start_pid = $$;
154155
my $exit;
155156
my $ok = eval { $exit = $self->launch_and_process($cb); 1 } // 0;
156157
my $err = $@;
157158

158-
if ($cleanup) {
159+
if ($cleanup && $start_pid == $$) {
159160
eval { $cleanup->(); 1 } or warn $@;
160161
}
161162

@@ -362,7 +363,6 @@ sub collect_job {
362363
);
363364
},
364365
sub {
365-
local $SIG{__WARN__} = sub { 1 };
366366
remove_tree($tempdir, {safe => 1, keep_root => 0}) if -d $tempdir;
367367
},
368368
$inst_ipc => $inst_con,

0 commit comments

Comments
 (0)