Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/intentions-queue
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-31 09:34:56 +0100
committerErich Eckner <git@eckner.net>2020-01-31 09:44:57 +0100
commitb2554880deb779f50aa82e73b247edf3a63b8837 (patch)
tree05003f4f29c58d03e92af987444f9280291e78ce /lib/intentions-queue
parent8048b29f90d956a295349d03ab91dcbd23106d34 (diff)
lib/intentions-queue: make intentions_left() work similar to flock and verbose_flock()
Diffstat (limited to 'lib/intentions-queue')
-rwxr-xr-xlib/intentions-queue11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/intentions-queue b/lib/intentions-queue
index e9b79de..c92a4d1 100755
--- a/lib/intentions-queue
+++ b/lib/intentions-queue
@@ -68,11 +68,18 @@ execute_intention() {
"${intentions_directory}/intention.${next_number}"
}
-# intentions_left
+# intentions_left [-n]
# check if there are undone intentions left
# return 0 if there is something left to do
# return 1 if nothing is queued
+# with -n: return immediately
+# without -n: wait until nothing more to do
intentions_left() {
+ if [ ! "x$1" = 'x-n' ]; then
+ while intentions_left -n; do
+ sleep 1
+ done
+ fi
find "${intentions_directory}" \
-maxdepth 1 \
-type f \
@@ -90,7 +97,7 @@ intentions_left() {
# execute_all_intentions
# executes all intentions
execute_all_intentions() {
- while intentions_left; do
+ while intentions_left -n; do
execute_intention
done
}