fix: surface xcrun stderr when simctl list fails - #37
Merged
Conversation
listDevicesInSet reads stdout with Output() so the JSON stays clean, but wrapped only the exit code on failure, discarding the stderr that exec.ExitError already captured. A Mac whose developer directory points at the Command Line Tools (which do not ship simctl) reported just "simctl list: exit status 72". Append ExitError.Stderr to the error, and when xcrun says it cannot find simctl at all, add a hint to select a full Xcode with xcode-select.
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
listDevicesInSetreads stdout with.Output()so the JSON stays clean, but on failure it wraps only the exit code, discarding the stderr thatexec.ExitErroralready captured.Every other simctl call in
simctl.go(boot,shutdown,rename, …) usesCombinedOutput()and appends the output to its error.listis the one exception, and it's the first command most users run.Repro
On a Mac whose developer directory points at the Command Line Tools (which don't ship simctl):
Before:
After:
Change
listErrorpulls stderr out ofexec.ExitErrorand appends it, matching the file's existingsimctl <verb>: %w: <output>style.xcode-select.TestFormatListError: pure table-driven unit test (no simulators booted), covering empty stderr, ordinary stderr, the missing-simctl hint, anderrors.Iswrapping.