1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

unposted: calendar system updates:

allow file locking to fall back; don't need dcop for kdialog
This commit is contained in:
Peter Stephenson 2010-04-13 16:28:21 +00:00
parent 1094863b35
commit c30b038a42
6 changed files with 26 additions and 11 deletions

View file

@ -266,9 +266,11 @@ chmod 600 $mycmds
# Attempt to lock both $donefile and $calendar.
# Don't lock $newfile; we've tried our best to make
# the name unique.
if zmodload -F zsh/system b:zsystem && zsystem supports flock; then
zsystem flock $calendar
zsystem flock $donefile
if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
zsystem flock $calendar 2>/dev/null &&
zsystem flock $donefile 2>/dev/null; then
# locked OK
:
else
calendar_lockfiles $calendar $donefile || exit 1
fi

View file

@ -74,8 +74,10 @@ fi
# Not needed but harmless if OS file locking is used.
{
if (( ! nolock )); then
if zmodload -F zsh/system b:zsystem && zsystem supports flock; then
zsystem flock $calendar
if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
zsystem flock $calendar 2>/dev/null; then
# locked OK
:
else
calendar_lockfiles $calendar || exit 1
fi

View file

@ -20,8 +20,10 @@ zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar
# start of block for following always to clear up lockfiles.
# Not needed but harmless if OS file locking is used.
{
if zmodload -F zsh/system b:zsystem && zsystem supports flock; then
zsystem flock $calendar
if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
zsystem flock $calendar 2>/dev/null; then
# locked OK
:
else
calendar_lockfiles $calendar || exit 1
fi

View file

@ -13,7 +13,7 @@ zmodload -i zsh/parameter || return
# HERE: this should be configurable and we should be able to do
# better if xmessage isn't available, e.g. wish.
if [[ -n $DISPLAY && $start -eq $stop ]]; then
if [[ -n ${commands[kdialog]} && -n $KDE_SESSION_UID ]] && dcop >&/dev/null
if [[ -n ${commands[kdialog]} && -n $KDE_SESSION_UID ]]
then
# We're in a KDE session, most probably.
# Simple:

View file

@ -16,8 +16,10 @@ zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar
# start of block for following always to clear up lockfiles.
# Not needed but harmless if OS file locking is used.
{
if zmodload -F zsh/system b:zsystem && zsystem supports flock; then
zsystem flock $calendar
if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
zsystem flock $calendar; then
# locked OK
:
else
calendar_lockfiles $calendar || exit 1
fi