Skip to content

Commit 44d03de

Browse files
committed
Trap CORE::GLOBAL::exit since we got rid of the exit method in rm (#670)
1 parent a8c62e5 commit 44d03de

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/rm/run.t

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ is( $class, 'PerlPowerTools::rm' );
1111
my $dir = File::Temp::tempdir( CLEANUP => 1 );
1212
chdir $dir or BAIL_OUT( "Could not change to $dir: $!" );
1313

14+
my $EXIT;
15+
BEGIN {
16+
*CORE::GLOBAL::exit = sub { $EXIT = $_[0] };
17+
}
1418

1519
# These are the elements in each row of the table
1620
my $n; BEGIN { $n = 0 }
@@ -163,12 +167,8 @@ subtest 'table' => sub {
163167
my $error = '';
164168
open my $error_fh, '>:utf8', \$error;
165169

166-
my $exit = do {
167-
no warnings qw(once redefine);
168-
local *PerlPowerTools::rm::exit = sub { return $_[1] };
169-
$class->run( args => \@run_args, error_fh => $error_fh );
170-
};
171-
is $exit, $row->[EXIT], "Exit code is " . $row->[EXIT];
170+
$class->run( args => \@run_args, error_fh => $error_fh );
171+
is $EXIT, $row->[EXIT], "Exit code is " . $row->[EXIT];
172172

173173
subtest 'what remains' => sub {
174174
pass() if @{ $row->[REMAINS] } == 0;

0 commit comments

Comments
 (0)