File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -5,23 +5,24 @@ pushd "$(dirname "$0")" >/dev/null
55cd ../modules/sentry-cocoa
66
77mkdir -p Carthage
8- LOCK_DIR =" $PWD /Carthage/.build.lock "
9- trap ' if [[ "$(cat "$LOCK_DIR/pid " 2>/dev/null)" == "$$" ]]; then rm -rf "$LOCK_DIR "; fi' EXIT
8+ PID_FILE =" $PWD /Carthage/.build.pid "
9+ trap ' if [[ "$(cat "$PID_FILE " 2>/dev/null)" == "$$" ]]; then rm -f "$PID_FILE "; fi' EXIT
1010
1111# Serialize concurrent invocations; parallel xcodebuilds race on DerivedData.
12- while ! mkdir " $LOCK_DIR " 2> /dev/null; do
13- build_pid=$( cat " $LOCK_DIR /pid" 2> /dev/null || true)
12+ TMP_FILE=$( mktemp " $PID_FILE .tmp.XXXXXX" )
13+ echo $$ > " $TMP_FILE "
14+ while ! ln " $TMP_FILE " " $PID_FILE " 2> /dev/null; do
15+ build_pid=$( cat " $PID_FILE " 2> /dev/null || true)
1416 if [[ -n " $build_pid " ]] && ! kill -0 " $build_pid " 2> /dev/null; then
1517 echo " Previous build did not complete (pid $build_pid ); cleaning up and retrying" >&2
16- # Atomically claim the stale dir via rename
17- if mv " $LOCK_DIR " " $LOCK_DIR .stale.$$ " 2> /dev/null; then
18- rm -rf " $LOCK_DIR .stale.$$ "
18+ if mv " $PID_FILE " " $PID_FILE .stale.$$ " 2> /dev/null; then
19+ rm -f " $PID_FILE .stale.$$ "
1920 fi
2021 continue
2122 fi
2223 sleep 2
2324done
24- echo $$ > " $LOCK_DIR /pid "
25+ rm -f " $TMP_FILE "
2526
2627current_sha=$( git rev-parse HEAD)
2728if [[ -f Carthage/.built-from-sha ]] && [[ " $( cat Carthage/.built-from-sha) " == " $current_sha " ]]; then
You can’t perform that action at this time.
0 commit comments