Run osascript with retry (#5090)

This commit is contained in:
Aleksandr Chebotov
2022-02-17 11:40:06 +03:00
committed by GitHub
parent cc2a6e1158
commit cb5ab38b09

View File

@@ -1,6 +1,16 @@
#!/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"
if [ -n "${openwindows}" ]; then