26 lines
488 B
Bash
Raw Normal View History

#!/usr/bin/env bash
LIB_SRC=${LIB_SRC:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}
2025-06-18 09:49:45 -03:00
# shellcheck source=./src/config.bash
source "${LIB_SRC}/config.bash"
clh_output_folder() {
echo "${OUTPUTS}/$1"
}
echoerr() {
echo "$@" >&2
2025-06-17 17:51:12 -03:00
}
await() {
local pid=$1 timeout=${2:-30} start="${SECONDS}"
2025-06-17 17:51:12 -03:00
while kill -0 "$pid"; do
if ((SECONDS - start > timeout)); then
echoerr "Error: timeout waiting for process $pid to exit"
return 1
fi
2025-06-17 17:51:12 -03:00
sleep 0.1
done
return 0
}