pnd_run.sh: improve wait for app exit
authorGrazvydas Ignotas <notasas@gmail.com>
Thu, 26 Nov 2015 23:56:59 +0000 (01:56 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Thu, 26 Nov 2015 23:56:59 +0000 (01:56 +0200)
it used to wait for pidof $EXENAME, which is not great as it's often
run.sh, meaning that if you have one running, others will never exit.

testdata/scripts/pnd_run.sh

index 2244ef3..0ea23e8 100755 (executable)
@@ -101,13 +101,9 @@ PND_WaitFor() {
 }
 
 PND_WaitForExit() {
-       local l_sleep=1
-       PID=$(pidof -o %PPID -x "$1")   # get pid of app
-       while [ -n "$PID" ]; do
-               sleep $l_sleep
-               test $l_sleep -lt 10 && l_sleep=$(($l_sleep + 1))
-               PID=$(pidof -o %PPID -x "$1")
-       done
+       # this used to wait for $1 ($EXENAME), but that doesn't work well
+       # when multiple PNDs run as too many PNDs have run.sh as $EXENAME
+       wait
 }
 
 PND_Exec() {