Skip to content
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

Add return_on_result flag, to return immediately when a result is received #105

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

noamraph
Copy link

@noamraph noamraph commented Dec 26, 2023

  • I have added an entry to CHANGELOG.md

Summary of changes

When I run a command and wait for the response, many times I don't want to wait for the entire timeout. So I added a flag return_on_result, which returns immediately when a response of type 'result' is received.

Notes:

  • I made this False by default to preserve backwards compatibility.
  • I added this flag to IoManager.write() as well, together with timeout_sec and raise_error_on_timeout which are also passed to get_gdb_response(). I added it after raise_error_on_timeout and before read_response, to keep it with the other get_gdb_response() flags. However, this will break code that sets read_response as a positional argument (meaning: iomanager.write('-cmd', timeout, raise_error_on_timeout, read_response). I leave it up to you to decide if you prefer better backwards compatibility or a more logical ordering of arguments.
  • The first two commits were just to make nox happy. The second commit might actually have some significance - it seems that .pyc files not in the root directory could be included in sdists.

Test plan

I added an automated test which sets the return_on_result flag and makes sure it returns fast. You can see it fail by replacing True with False in test_gdbcontroller.py:

    responses = gdbmi.write(["-rubbish"], return_on_result=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant