Skip to content

Commit

Permalink
Improved the test against the base_dir parameter: the directory must not
Browse files Browse the repository at this point in the history
exist as a regular file or something that is not a directory (e.g., a FIFO).
  • Loading branch information
fluca1978 committed Dec 17, 2015
1 parent 2f16e8b commit 09d62a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Parallel/Scoreboard.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ sub new {
my %args = @_;
die 'mandatory parameter:base_dir is missing'
unless $args{base_dir};
die "directory $args{base_dir} exists and is not a directory!"
if ( -e $args{base_dir} && ! -d $args{base_dir} );
# create base_dir if necessary
if (! -e $args{base_dir}) {
if (! -d $args{base_dir}) {
mkpath $args{base_dir}
or die "failed to create directory:$args{base_dir}:$!";
}

# build object
my $self = bless {
worker_id => sub { $$ },
Expand Down

0 comments on commit 09d62a2

Please sign in to comment.