diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2010-02-26 12:09:20 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2010-02-26 12:09:20 +0000 |
| commit | 07b6256d8ea03805dd8a24c184bf455ee31d6115 (patch) | |
| tree | 98e16977e063db6d46c7b13e4b82c3cef3978dd9 /Functions/Calendar/calendar_edit | |
| parent | users/14891: say that condition arguments don't do globbing (diff) | |
| download | zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.gz zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.bz2 zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.lz zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.xz zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.zst zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.zip | |
27756: add OS file locking to calendar
add errflag test to loop over fcntl()
Diffstat (limited to 'Functions/Calendar/calendar_edit')
| -rw-r--r-- | Functions/Calendar/calendar_edit | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Functions/Calendar/calendar_edit b/Functions/Calendar/calendar_edit index e31decb76..e3ac5c39b 100644 --- a/Functions/Calendar/calendar_edit +++ b/Functions/Calendar/calendar_edit @@ -10,12 +10,21 @@ done zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar +# 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. { - calendar_lockfiles $calendar || return 1 + if zmodload -F zsh/system b:zsystem && zsystem supports flock; then + zsystem flock $calendar + else + calendar_lockfiles $calendar || exit 1 + fi eval $editor \$calendar } always { (( ${#lockfiles} )) && rm -f $lockfiles } +) (( cal_running )) && calendar -s |
