Skip to content

Commit

Permalink
Eliminate errors for directories that don't exist
Browse files Browse the repository at this point in the history
If one of the reported search paths doesn't exist, don't call `find` to
search it.
  • Loading branch information
bwarden committed Aug 11, 2023
1 parent a9a7297 commit e4e0905
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/clr-check-perl-modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
my %results;
# Scan longest stems first
my @basedirs = sort { length($b) <=> length($a) } keys %patterns;
BASEDIR:
foreach my $basedir (@basedirs) {
# Skip ahead if this directory doesn't exist
next BASEDIR unless -d $basedir;
foreach my $pattern (sort { length($b) <=> length($a) }
keys %{$patterns{$basedir}}) {
open(my $fh, "-|", "find ${basedir} -type d")
Expand Down

0 comments on commit e4e0905

Please sign in to comment.