Skip to content

Can you explain why headless requires a sleep for the same code that does not from the UI? #2296

Answered by bpotchik
Vasco-jofra asked this question in Q&A
Discussion options

You must be logged in to vote

In headless you should use new_bv.update_analysis_and_wait() instead of sleep.

This is different than the scripting console in the full UI because in that case, we assume you want to see updated results immediately for any command you run as it violates the principal of least surprise. You can see that here:

https://github.com/Vector35/binaryninja-api/blob/dev/python/scriptingprovider.py#L676-L677

Headless however is much more likely to be building a set of actions and you may want more control over when analysis updates since you can queue up multiple actions without being able to see the results.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by psifertex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2295 on March 04, 2021 17:08.