Skip to content

Commit

Permalink
Silence warnings when a pidfile is not set. Don't try to write a pidfile
Browse files Browse the repository at this point in the history
if it has not been enabled in the settings.
  • Loading branch information
lwsitu committed Mar 20, 2010
1 parent ec7487f commit d80bb7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Bot/Pastebot/Administrivia.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sub get_pid {
my $name = _get_name();
my %conf = get_items_by_name($name);
my $pidfile = $conf{pidfile};
return unless -e $pidfile;
return unless $pidfile && -e $pidfile;
my $pid = do {
local $/;
open my $fh, '<', $pidfile or die "open($pidfile): $!";
Expand All @@ -56,6 +56,7 @@ sub write_pidfile {
my $name = _get_name();
my %conf = get_items_by_name($name);
my $pidfile = $conf{pidfile};
return unless $pidfile;
open my $fh, '>', $pidfile or die "open($pidfile): $!";
print $fh $$;
close $fh;
Expand Down

0 comments on commit d80bb7d

Please sign in to comment.