diff --git a/images/macos/provision/core/open_windows_check.sh b/images/macos/provision/core/open_windows_check.sh index 1392e0654..002c254bd 100644 --- a/images/macos/provision/core/open_windows_check.sh +++ b/images/macos/provision/core/open_windows_check.sh @@ -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