-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1768 from HEXRD/fix-hdiutil-spurious-failures
Repeat "hdiutil create" commands to avoid failures
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Workaround XProtect race condition for "hdiutil create" for MacOS 13 | ||
|
||
set -e | ||
|
||
if [ "$1" != "create" ]; then | ||
# If it isn't an `hdiutil create` command, just run and exit normally | ||
hdiutil "$@" | ||
exit 0 | ||
fi | ||
|
||
# For an `hdiutil create` command, try repeatedly, up to 10 times | ||
# This prevents spurious errors caused by a race condition with XProtect | ||
# See https://github.com/actions/runner-images/issues/7522 | ||
i=0 | ||
until | ||
hdiutil "$@" | ||
do | ||
if [ $i -eq 10 ]; then exit 1; fi | ||
i=$((i+1)) | ||
sleep 1 | ||
done |