Skip to content

Commit 6a85243

Browse files
committed
fix(appium): pin boot check to selected UDID
1 parent 1d4326e commit 6a85243

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎appium/scripts/run-local/runtime.sh‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,21 @@ for ver, rt, avail in sorted(runtimes, reverse=True):
8484
info "Falling back to '$IOS_SIMULATOR' (iOS $OS_VERSION, $udid). Set DEVICE / OS_VERSION / IOS_RUNTIME in $SCRIPT_DIR/.env to pin a different one."
8585
fi
8686

87-
if xcrun simctl list devices booted 2>/dev/null | grep -q "Booted"; then
88-
info "Simulator already running"
87+
# Keep every later step pinned to the simulator selected above. In
88+
# particular, `booted` is ambiguous when multiple simulators are running.
89+
UDID="$udid"
90+
91+
if xcrun simctl list devices booted 2>/dev/null | grep -q "$UDID"; then
92+
info "Simulator already running ($UDID)"
8993
return
9094
fi
9195

92-
info "Booting simulator '$IOS_SIMULATOR' ($udid)..."
93-
xcrun simctl boot "$udid" 2>/dev/null || true
96+
info "Booting simulator '$IOS_SIMULATOR' ($UDID)..."
97+
xcrun simctl boot "$UDID" 2>/dev/null || true
9498
open -a Simulator
9599

96100
info "Waiting for simulator..."
97-
local retries=0
98-
while ! xcrun simctl list devices booted 2>/dev/null | grep -q "Booted"; do
99-
retries=$((retries + 1))
100-
[[ $retries -gt 60 ]] && error "Simulator failed to boot after 60s"
101-
sleep 1
102-
done
101+
xcrun simctl bootstatus "$UDID" -b >/dev/null
103102
info "Simulator ready"
104103
}
105104

0 commit comments

Comments
 (0)