summaryrefslogtreecommitdiffstats
path: root/src/globals
diff options
context:
space:
mode:
Diffstat (limited to 'src/globals')
-rw-r--r--src/globals14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/globals b/src/globals
index 0d573e2..af411fe 100644
--- a/src/globals
+++ b/src/globals
@@ -95,6 +95,20 @@ function checkyesno() {
}
+## Waits until a statement succeeds or a timeout occurs
+# $1: timeout in seconds
+# $2...: condition command
+function timeout_wait() {
+ local timeout="$1"
+ shift
+ while ! eval "$*"; do
+ (( timeout-- > 0 )) || return 1
+ sleep 1
+ done
+ return 0
+}
+
+
### Load all +x files in $HOOKS_DIR
function load_hooks() {
local hook