From c2ea00933752846d8e6ef0d05efc092f39773a65 Mon Sep 17 00:00:00 2001 From: Dan Sheppard <ds23@sanger.ac.uk> Date: Fri, 10 Aug 2012 09:39:40 +0000 Subject: [PATCH] return boolean rather than dieing in lock/unlock. Seems to be more idiomatic on experiencing an unexpected system call failure in this file than die. --- modules/Bio/EnsEMBL/Utils/ConversionSupport.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm index 23a03bc190..5c99705d79 100644 --- a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm +++ b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm @@ -1203,8 +1203,9 @@ sub lock_log { my $fh = $self->{'_log_filehandle'}; return if -t $fh or -p $fh; # Shouldn't lock such things - flock($self->{'_log_filehandle'},LOCK_EX) || die "Cannot lock log: $!"; + flock($self->{'_log_filehandle'},LOCK_EX) || return 0; seek($self->{'_log_filehandle'},0,SEEK_END); # fail ok, prob not reg file + return 1; } =head2 unlock_log @@ -1219,7 +1220,8 @@ sub unlock_log { my $fh = $self->{'_log_filehandle'}; return if -t $fh or -p $fh; # We don't lock such things # flush is implicit in flock - flock($self->{'_log_filehandle'},LOCK_UN) || die "Cannot unlock log"; + flock($self->{'_log_filehandle'},LOCK_UN) || return 0; + return 1; } =head2 log_warning -- GitLab