From c25cf8cce93085ee264c587d961cbf4c876698b0 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Tue, 13 Sep 2016 21:33:54 -0700 Subject: [PATCH] avoid simctl switch crash and avoid logging pid of springboard --- scripts/reset-simulators.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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"