Skip to content

Commit

Permalink
rmdir: better error reporting (#803)
Browse files Browse the repository at this point in the history
* The old error message is not specific enough to be helpful
* Allow rmdir() to fail instead of performing file tests first
* $! will specifically say whether a file argument does not exist, or is not a directory
  • Loading branch information
mknos authored Nov 13, 2024
1 parent 9cc12e8 commit 8895e4b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions bin/rmdir
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ if (!getopts('p', \%opt) || scalar(@ARGV) == 0) {
exit EX_FAILURE;
}
foreach my $directory (@ARGV) {
unless (-d $directory) {
warn "$Program: '$directory': not a directory or does not exist\n";
$rc = EX_FAILURE;
next;
}
unless (rmdir $directory) {
warn "$Program: failed to remove '$directory': $!\n";
$rc = EX_FAILURE;
Expand Down

0 comments on commit 8895e4b

Please sign in to comment.