New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[snapshot] wait for simulator to boot before overriding status bar #19344
[snapshot] wait for simulator to boot before overriding status bar #19344
Conversation
`xcrun instruments` fails with the error "xcrun: error: Failed to locate 'instruments'." This command will boot the simulator if it's not curerntly booted and then wait for it finish booting before terminating. Fixes fastlane#19317.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick question on the difference between this two subcommands 🙃 This would be ag great fix but just a little bit curious at what this change actually does 😛
Helper.backticks("xcrun instruments -w #{device_udid} &> /dev/null") | ||
# Boot the simulator and wait for it to finish booting | ||
Helper.backticks("xcrun simctl bootstatus #{device_udid} -b &> /dev/null") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you happen to have any good documentation or explanation on what the difference between these two commands are? I tried to look at the help/man pages and couldn't really find too much h🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Xcode 12.5.1 as the current Xcode xcrun instruments
outputs:
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
instruments, version 12.5.1 (64544.132)
usage: instruments [-t template] [-D document] [-l timeLimit] [-w device] [-P package] [[-p pid] | [application [-e variable value] [argument ...]]]
man instruments
describes -w
as:
-w [hardware device, or simulator name]
The name or identifier of the hardware device or simulator to target. Should be specified first
(you probably found this documentation but I'm adding it for completeness)
The behaviour has either changed or this never worked because using instruments to boot the simulator only boots the simulator (it doesn't wait for it to be ready) and exits with an error:
instruments[2650]: Waiting for device to boot...
Instruments Usage Error: No template (-t) specified
instruments, version 12.5.1 (64544.132)
usage: instruments [-t template] [-D document] [-l timeLimit] [-w device] [-P package] [[-p pid] | [application [-e variable value] [argument ...]]]
bootstatus
is not listed in xcrun simctl help
but does have help text available via xcrun simctl help bootstatus
:
Checks device boot status.
Usage: simctl bootstatus <device> [-bcd]
-b Boot the device if it isn't already booted.
-d Print data migration information, if it's available.
-c Continuously monitor boot status through multiple boot/shutdown cycles.
Monitors the specified device and prints boot status information until the device finishes booting. You can safely call this before you attempt to start booting the device.
I found this quite confusing myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my goodness! The xcrun simctl help bootstatus
is the command I need to find but couldn't 😓 Thank you so much for this! It does appear that this never really worked then 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hidden! 😔 I would love to know if there are any other (hidden) commands available but this is the only one I'm aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this tipp! This saved me from HOURS of debugging in my screenshotting tool!
@JosephDuffy Quick question for you! Is your status bar actually changing like you are expecting it to in your screenshots? I actually can't get this to work for me 😬 What are the options you are using with |
@JosephDuffy Turns out I was an idiot and somehow deleted my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is amazing and seems to fix the issue happening on this discussion 👉 #17021
Thank you so much for this! Really appreciate it ❤️
Hey @JosephDuffy 👋 Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉 Please let us know if this change requires an immediate release by adding a comment here 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations! 🎉 This was released as part of fastlane 2.194.0 🚀
Thanks for the quick review and merge Josh! |
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
If the simulator is not booted when the status bar is updated it does not do anything and the default status bar is used.
Resolves #19317
Description
xcrun instruments
fails with the error "xcrun: error: Failed to locate 'instruments'." This command will boot the simulator if it's not curerntly booted and then wait for it finish booting before terminating.Testing Steps
Use
snapshot
while theoverride_status_bar
option istrue
.Some of the tests failed for me, although they do not seem related to this change.