diff options
Diffstat (limited to 'Functions/Calendar/calendar_add')
-rw-r--r-- | Functions/Calendar/calendar_add | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Functions/Calendar/calendar_add b/Functions/Calendar/calendar_add index 280e5f365..ac5caecd7 100644 --- a/Functions/Calendar/calendar_add +++ b/Functions/Calendar/calendar_add @@ -68,9 +68,18 @@ if [[ $addline = ${~uidpat} ]]; then my_uid=${(U)match[1]} fi +# start of subshell for OS file locking +( # start of block for following always to clear up lockfiles. +# Not needed but harmless if OS file locking is used. { - (( nolock )) || calendar_lockfiles $calendar || return 1 + if (( ! nolock )); then + if zmodload -F zsh/system b:zsystem && zsystem supports flock; then + zsystem flock $calendar + else + calendar_lockfiles $calendar || exit 1 + fi + fi if [[ -f $calendar ]]; then calendar_read $calendar @@ -158,4 +167,5 @@ Old calendar left in $calendar.old." >&2 (( ${#lockfiles} )) && rm -f $lockfiles } -return $rstat +exit $rstat +) |