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

Python: Add timeout option to open() to kill time-consuming cmd() calls #47

Merged
merged 2 commits into from
May 24, 2023

Conversation

arieltorti
Copy link
Contributor

@arieltorti arieltorti commented May 23, 2023

Proposed changes to fix #46

Usage:

import rzpipe

pipe = rzpipe.open("/bin/ls", cmd_timeout=10)
pipe.cmd('aa')
pipe.quit()

When the timeout is triggered it will throw an exception:

TimeoutError: Timeout of 10 seconds reached on 'rzpipe.cmd: aa'

By default, it won't enable timeout to be backward compatible

@arieltorti arieltorti force-pushed the add-timeout-to-python-cmd branch 2 times, most recently from 80fb6c0 to 6b9b5eb Compare May 23, 2023 22:46
@wargio
Copy link
Member

wargio commented May 24, 2023

Nice! it makes sense to have a timeout on the command, but is not clear the time unit. can you rename it as cmd_timeout_ms or whatever is the time unit?

@arieltorti arieltorti force-pushed the add-timeout-to-python-cmd branch from 6b9b5eb to b88d8d2 Compare May 24, 2023 14:26
@arieltorti arieltorti force-pushed the add-timeout-to-python-cmd branch from b88d8d2 to 82f63a9 Compare May 24, 2023 14:36
@dgutson
Copy link

dgutson commented May 24, 2023

thanks @XVilka @wargio , how do we proceed from here so this becomes available with pip install? rizin is hanging badly in a situation and is harmful for us

@wargio
Copy link
Member

wargio commented May 24, 2023

can you also bump the version? so we can just upload a new version to pip

@arieltorti
Copy link
Contributor Author

I bumped it to 0.5.0 since we added a feature, let me know if you want to change it

Copy link
Member

@wargio wargio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

@arieltorti arieltorti force-pushed the add-timeout-to-python-cmd branch from 5b0c0ae to 10e5d25 Compare May 24, 2023 16:14
@wargio wargio merged commit a79c41b into rizinorg:master May 24, 2023
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.

Enable a timer for rzpipe in python
4 participants