Skip to content

Commit c53a468

Browse files
Use bootstatus -b for bazel run of a simulator application (#2771)
Aligns with what we are doing in tests. Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent 7ce968d commit c53a468

1 file changed

Lines changed: 6 additions & 21 deletions

File tree

apple/internal/templates/apple_simulator.template.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import subprocess
5858
import sys
5959
import tempfile
60-
import time
6160
from typing import Dict, Optional
6261
import zipfile
6362

@@ -377,26 +376,12 @@ def wait_for_sim_to_boot(simctl_path: str, udid: str) -> bool:
377376
True if the simulator boots within 60 seconds, False otherwise.
378377
"""
379378
logger.info("Waiting for simulator to boot...")
380-
for _ in range(0, 60):
381-
# The expected output of "simctl list" is like:
382-
# -- iOS 8.4 --
383-
# iPhone 5s (E946FA1C-26AB-465C-A7AC-24750D520BEA) (Shutdown)
384-
# TestDevice (8491C4BC-B18E-4E2D-934A-54FA76365E48) (Booted)
385-
# So if there's any booted simulator, $booted_device will not be empty.
386-
simctl_list_result = subprocess.run(
387-
[simctl_path, "list", "devices"],
388-
encoding="utf-8",
389-
check=True,
390-
stdout=subprocess.PIPE,
391-
)
392-
for line in simctl_list_result.stdout.split("\n"):
393-
if line.find(udid) != -1 and line.find("Booted") != -1:
394-
logger.debug("Simulator is booted.")
395-
# Simulator is booted.
396-
return True
397-
logger.debug("Simulator not booted, still waiting...")
398-
time.sleep(1)
399-
return False
379+
subprocess.run(
380+
[simctl_path, "bootstatus", udid, "-b"],
381+
encoding="utf-8",
382+
check=True,
383+
)
384+
return True
400385

401386

402387
def boot_simulator(*, developer_path: str, simctl_path: str, udid: str) -> None:

0 commit comments

Comments
 (0)