-
Notifications
You must be signed in to change notification settings - Fork 41
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
Timeout support #10
Comments
See discussion at assert-rs/assert_cli#67 |
From previous thread
|
Many of our problems with `stdin` are derived from using extension traits. By moving away from them, we fix the API problems and make it easier to add other features like timeout (assert-rs#10) or signalling (assert-rs#84). So the new philosphy if: - Core functionality is provided by extension traits - Provide a convinience API that makes `Command` friendlier. These do not need to be generalized. Other abstractions can provide their own (like `duct`). Fixes assert-rs#73
For my use, I'm simply looping through all my currently-live commands and calling thread::sleep(10ms) before looping again. Not pretty but it works. I've found 10ms to be useful even on my slow-ish CI. A better solution would use futures, but I'm not sure what futures are available to wait for process exit. Presumably, implementing those futures is assrt_cmd's job. Note that I use a generic You can steal code from https://gist.github.com/vincentdephily/592546c41ff9713adff234e5535aa6d4 |
@epage I created a crate that should help with this: You can use |
We test with `failure` because Linux considers it `interrupted` but not windows. `failure` is common to both platforms. Fixes assert-rs#10
In getting feedback, there came up the need for timeout support.
We'd have to run the command in a thread, sleep for the time (in small increments?), and then call kill if needed.
https://doc.rust-lang.org/std/process/struct.Child.html#method.kill
The text was updated successfully, but these errors were encountered: