From 6aaac89ab3302363ed23681979dd8c22b1cc4062 Mon Sep 17 00:00:00 2001 From: weilaaa Date: Fri, 7 Jan 2022 14:10:08 +0800 Subject: [PATCH] add error message when wait file exist timeout Signed-off-by: weilaaa --- hack/util.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/util.sh b/hack/util.sh index 12bf045deca6..4a2b7774b20b 100755 --- a/hack/util.sh +++ b/hack/util.sh @@ -222,7 +222,7 @@ function util::wait_for_condition() { local timeout=${3:-} local start_msg="Waiting for ${msg}" - local error_msg="[ERROR] Timeout waiting for ${msg}" + local error_msg="[ERROR] Timeout waiting for condition ${msg}" local counter=0 while ! eval ${condition}; do @@ -251,12 +251,14 @@ function util::wait_for_condition() { function util::wait_file_exist() { local file_path=${1} local timeout=${2} + local error_msg="[ERROR] Timeout waiting for file exist ${file_path}" for ((time=0; time<${timeout}; time++)); do if [[ -e ${file_path} ]]; then return 0 fi sleep 1 done + echo -e "\n${error_msg}" return 1 }