1
0
mirror of https://github.com/limosek/zaf.git synced 2025-11-01 18:17:37 +01:00

New syntax and tests

This commit is contained in:
Lukas Macura
2016-04-21 15:29:48 +02:00
parent 76ba5b9ad9
commit 957c53958c
9 changed files with 198 additions and 74 deletions

View File

@@ -13,7 +13,7 @@ shift
[ -z "${ZAF_LOCK_SECONDS}" ] && seconds=5
[ -z "${ZAF_LOCK_FORCE}" ] && force=1
lockfile="${ZAF_TMP_DIR}/zaflock_${lkey}"
lockfile="/tmp/zaflock_${lkey}"
i=0
while [ -f "$lockfile" ] && [ $i -lt $seconds ]; do
sleep 1
@@ -28,7 +28,6 @@ if [ -f "$lockfile" ] && [ -z "$force" ]; then
exit 1
fi
touch "$lockfile"
[ -n "$*" ] && $@
rm -f "$lockfile"
[ -n "$*" ] && $@ 2>"$lockfile"
[ -s "$lockfile" ] && zaf_wrn <"$lockfile"