diff options
author | Craig A. Berry <craigberry@mac.com> | 2017-01-14 15:44:15 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2017-01-14 16:33:43 -0600 |
commit | 4767d89388527b747495568a327247ba5b9c72bf (patch) | |
tree | adc98209415fac8491087a2dac606549d1a88c58 /cpan | |
parent | 1d86dd2f9a6c95dbe3230acac995ec2205513b0d (diff) | |
download | perl-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')
-rw-r--r-- | cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t | 8 |
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->(); |