Skip to content

Commit

Permalink
avoid simctl switch crash and avoid logging pid of springboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim committed Sep 14, 2016
1 parent e1489be commit c25cf8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/reset-simulators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

0 comments on commit c25cf8c

Please sign in to comment.