From c51c26f280e620b870fd13274a0a3a65dff697ea Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 29 Nov 2013 15:52:07 -0500 Subject: [PATCH] Add lock cleanup code. --- calendar-export.plx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/calendar-export.plx b/calendar-export.plx index 6479c3e..91adcf0 100644 --- a/calendar-export.plx +++ b/calendar-export.plx @@ -46,7 +46,21 @@ use File::Temp qw/:POSIX tempfile/; use DateTime::TimeZone; use Date::Manip; use DateTime::Format::ICal; -use Date::ICal; + +my($CONFIG_FILE) = (@ARGV); + +if (@ARGV != 1) { + print STDERR "usage: $0 \n"; + exit 1; +} +############################################################################### +my $CALENDAR_LOCK_FILE = "$ENV{HOME}/.emacs-calendar-to-ics-lock"; + +my $LOCK_CLEANUP_CODE = sub { + return (unlink($CALENDAR_LOCK_FILE) != 1) ? + "Failed unlink of $CALENDAR_LOCK_FILE. Could cause trouble." : + ""; +}; ############################################################################### { my %messageHistory;