Commit 14935049 authored by Guillaume Pasero's avatar Guillaume Pasero

PKG: use a retry loop to close otbgui

parent 665b5a6b
......@@ -122,25 +122,32 @@ for app in $OTB_APPS; do
echo "" >tmp.log
"bin/otbgui_$app" >tmp.log 2>&1 &
GUI_PID=$!
sleep 5s
# Check process tree
CHILD_PROC=$(ps_children $GUI_PID | grep "bin/otbgui $app")
if [ -n "$CHILD_PROC" ]; then
CHILD_PID=$(echo "$CHILD_PROC" | cut -d ' ' -f 1)
NEXT_CHILD_PROC=$(ps_children "$CHILD_PID" | grep 'otbApplicationLauncherQt')
if [ -n "$NEXT_CHILD_PROC" ]; then
NEXT_CHILD_PID=$(echo "$NEXT_CHILD_PROC" | cut -d ' ' -f 1)
kill -9 "$NEXT_CHILD_PID"
wait "$NEXT_CHILD_PID" 2>/dev/null
else
echo "ERROR: otbApplicationLauncherQt $app failed to launch"
tee -a selftest_report.log < tmp.log
exit_if
CHILD_PID=""
NEXT_CHILD_PID=""
nb_try=0
while [ -z "$NEXT_CHILD_PID" -a $nb_try -lt 10 ]; do
sleep 1s
CHILD_PROC=$(ps_children $GUI_PID | grep "bin/otbgui $app")
if [ -n "$CHILD_PROC" ]; then
CHILD_PID=$(echo "$CHILD_PROC" | cut -d ' ' -f 1)
NEXT_CHILD_PROC=$(ps_children "$CHILD_PID" | grep 'otbApplicationLauncherQt')
if [ -n "$NEXT_CHILD_PROC" ]; then
NEXT_CHILD_PID=$(echo "$NEXT_CHILD_PROC" | cut -d ' ' -f 1)
fi
fi
nb_try=$(( nb_try + 1 ))
done
if [ -n "$NEXT_CHILD_PID" ]; then
kill -9 "$NEXT_CHILD_PID"
wait "$NEXT_CHILD_PID" 2>/dev/null
elif [ -n "$CHILD_PID" ]; then
echo "ERROR: otbApplicationLauncherQt $app failed to launch"
tee -a selftest_report.log < tmp.log
exit_if
else
echo "ERROR: bin/otbgui_$app failed to launch"
tee -a selftest_report.log < tmp.log
exit_if
echo "ERROR: bin/otbgui_$app failed to launch"
tee -a selftest_report.log < tmp.log
exit_if
fi
fi
app_index=$(( app_index + 1 ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment