Run osascript with retry (#5090)
This commit is contained in:
@@ -1,6 +1,16 @@
|
|||||||
#!/bin/bash -e -o pipefail
|
#!/bin/bash -e -o pipefail
|
||||||
|
|
||||||
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)')
|
retry=10
|
||||||
|
while [ $retry -gt 0 ]; do
|
||||||
|
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)') && break
|
||||||
|
|
||||||
|
retry=$((retry-1))
|
||||||
|
if [ $retry -eq 0 ]; then
|
||||||
|
echo "No retry attempts left"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 30
|
||||||
|
done
|
||||||
IFS=',' read -r -a windowslist <<< "$openwindows"
|
IFS=',' read -r -a windowslist <<< "$openwindows"
|
||||||
|
|
||||||
if [ -n "${openwindows}" ]; then
|
if [ -n "${openwindows}" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user