Error on first run after iOS simulator is updated
- Dominant language
- Python
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 40
Description
The first time you attempt to run an app in the iOS simulator after installing or updating the iOS simulator, the simulator fails to start at the point when it tries to identify the available simulators.
**To Reproduce**
Steps to reproduce the behavior:
1. On a completely clean macOS install, install Xcode
2. Generate a new Briefcase project
3. run `briefcase run iOS`
4. Briefcase fails with the error: "Unable to parse output of xcrun simctl":
[briefcase.2022_07_06-11_12_50.run.log](https://github.com/beeware/briefcase/files/9051672/briefcase.2022_07_06-11_12_50.run.log)
The error will also occur when Xcode undergoes a major version update, and the simulator is updated.
**Expected behavior**
Briefcase should present a list of available simulator images on first run.
**Environment:**
- Operating System: macOS (any)
- Python version: any
- Software versions:
- Briefcase: 0.3.8
**Additional context**
The problem appears to be caused by stray content in the output being parsed. From the log above:
```
>>> Running Command: subprocess.py:434
>>> xcrun simctl list -j subprocess.py:435
>>> Command Output: subprocess.py:453
>>> Install Started subprocess.py:455
>>> 1%.........20.........40.........60.........80.........Install Succeeded subprocess.py:455
>>> { subprocess.py:455
>>> "devicetypes" : [ subprocess.py:455
>>> { subprocess.py:455
>>> "productFamily" : "iPhone", subprocess.py:455
>>> "bundlePath" : subprocess.py:455
...
```
Briefcase currently takes the literal output of the command, and attempts to parse it as JSON. The stray content in the first two lines ("Install started, 1%... ") isn't valid JSON, so the parse fails.
When you run a second time, the stray content isn't present; the entire command output is parseable JSON.
Contributor guide
Research direction
The issue points to the xcrun simctl list -j invocation and its command-output parsing; start by reproducing the first-run behavior on macOS and tracing that output. Done means Briefcase can handle the simulator-install progress text, parse the JSON, and present the available simulator images.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100