diff --git a/scripts/reset-simulators.sh b/scripts/reset-simulators.sh index 136b05df75e..8b2e487fd07 100755 --- a/scripts/reset-simulators.sh +++ b/scripts/reset-simulators.sh @@ -13,6 +13,9 @@ while pgrep -q Simulator; do pkill -9 Simulator 2>/dev/null || true done +# Run once since switching simulator versions often causes CoreSimulatorService to throw an exception. +xcrun simctl list devices >/dev/null 2>&1 || true + # Shut down booted simulators xcrun simctl list devices -j | ruby -rjson -e 'puts JSON.parse($stdin.read)["devices"].flat_map { |d| d[1] }.select { |d| d["state"] == "Booted" && d["availability"] == "(available)" }.map { |d| d["udid"] }' | while read udid; do echo "shutting down simulator with ID: $udid" @@ -37,5 +40,5 @@ until xcrun simctl list devices -j | ruby -rjson -e 'exit JSON.parse($stdin.read done # Wait until the simulator is fully booted by waiting for it to launch SpringBoard -xcrun simctl launch booted com.apple.springboard || true +xcrun simctl launch booted com.apple.springboard >/dev/null 2>&1 || true echo "simulator booted"