summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2017-01-14 15:44:15 -0600
committerCraig A. Berry <craigberry@mac.com>2017-01-14 16:33:43 -0600
commit4767d89388527b747495568a327247ba5b9c72bf (patch)
treeadc98209415fac8491087a2dac606549d1a88c58 /cpan/Test-Simple
parent1d86dd2f9a6c95dbe3230acac995ec2205513b0d (diff)
downloadperl-4767d89388527b747495568a327247ba5b9c72bf.tar.gz
Use File::Spec->catfile() in Test2's Files.t test.
Explicitly using forward slashes to concatenate filenames is not portable and we've already loaded File::Spec anyway. Also, don't try to remove the directory we're cleaning up unless we were successful in opening it.
Diffstat (limited to 'cpan/Test-Simple')
-rw-r--r--cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t
index 0e79101d51..367d0ef6a0 100644
--- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t
+++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t
@@ -160,11 +160,13 @@ ok(!-d $tmpdir, "cleaned up temp dir");
if (opendir(my $d, $tmpdir)) {
for my $f (readdir($d)) {
next if $f =~ m/^\.+$/;
- next unless -f "$tmpdir/$f";
- unlink("$tmpdir/$f");
+ my $file = File::Spec->catfile($tmpdir, $f);
+ next unless -f $file;
+ 1 while unlink $file;
}
+ closedir($d);
+ rmdir($tmpdir) or warn "Could not remove temp dir '$tmpdir': $!";
}
- rmdir($tmpdir) or warn "Could not remove temp dir '$tmpdir': $!";
};
$cleanup->();