-
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.
Repeat "hdiutil create" commands to avoid failures
Race conditions with XProtect on macos-13 can cause spurious failures for `hdiutil create` commands. As a work-around, try the `hdiutil create` command several times (up to 10), and only fail if the command fails each time. Signed-off-by: Patrick Avery <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Workaround XProtect race condition for "hdiutil create" for MacOS 13 | ||
|
||
if [ "$1" != "create" ]; then | ||
# If it isn't an `hdiutil create` command, just run and exit normally | ||
exit $(hdiutil "$@") | ||
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 |