We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4bc9961 commit 1de411aCopy full SHA for 1de411a
1 file changed
rootfs/imagebuilder/build
@@ -14,16 +14,17 @@ trap clean_before_exit EXIT
14
function waiting_process {
15
echo -e "\\033[32m---> Waiting $1 running.\\033[0m"
16
for i in {0..4}; do
17
- pid=$(pgrep "$1")
18
- if [ -z "$pid" ] && [[ $i == 3 ]]; then
19
- echo -e "\\033[31m---> Process $1 failed.\\033[0m"
20
- exit 1
21
- elif [ -z "$pid" ]; then
22
- sleep 3
23
- else
+ if ps -C "$1" 1>/dev/null ; then
24
sleep 1
25
- echo -e "\\033[32m---> Process $1 started.\\033[0m"
+ echo -e "\\033[32m---> Process $1 started.\\033[0m"
26
break
+ else
+ if [[ $i == 3 ]]; then
+ echo -e "\\033[31m---> Process $1 failed.\\033[0m"
+ exit 1
+ sleep 3
27
+ fi
28
fi
29
done
30
}
0 commit comments