Skip to content

Commit 1de411a

Browse files
committed
fix(imagebuilder): waiting_process exit
1 parent 4bc9961 commit 1de411a

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

rootfs/imagebuilder/build

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ trap clean_before_exit EXIT
1414
function waiting_process {
1515
echo -e "\\033[32m---> Waiting $1 running.\\033[0m"
1616
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
17+
if ps -C "$1" 1>/dev/null ; then
2418
sleep 1
25-
echo -e "\\033[32m---> Process $1 started.\\033[0m"
19+
echo -e "\\033[32m---> Process $1 started.\\033[0m"
2620
break
21+
else
22+
if [[ $i == 3 ]]; then
23+
echo -e "\\033[31m---> Process $1 failed.\\033[0m"
24+
exit 1
25+
else
26+
sleep 3
27+
fi
2728
fi
2829
done
2930
}

0 commit comments

Comments
 (0)