diff --git a/proxDoc.sh b/proxDoc.sh index 2f4af97..c578442 100755 --- a/proxDoc.sh +++ b/proxDoc.sh @@ -128,6 +128,24 @@ get_disk_list() { echo "$DISK_LIST" } +# Efficient process wait with optional spinner +# Usage: wait_for_process $pid [delay] +# Uses kill -0 instead of ps -p for efficiency +wait_for_process() { + local pid="$1" + local delay="${2:-0.1}" + local spinner='|/-\' + local i=0 + + while kill -0 "$pid" 2>/dev/null; do + printf "\r%c " "${spinner:i++%${#spinner}:1}" + sleep "$delay" + done + printf "\r \r" # Clear spinner + wait "$pid" + return $? +} + ################### # System Information Functions ###################