-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: Allow users to override the timeout #45
base: main
Are you sure you want to change the base?
Conversation
src/lib.rs
Outdated
@@ -78,5 +80,5 @@ pub trait Runtime: std::fmt::Debug { | |||
fn register(&mut self, name: &str, content: &str) -> std::io::Result<()>; | |||
|
|||
/// Get the output from typing `input` into the shell | |||
fn complete(&mut self, input: &str, term: &Term) -> std::io::Result<String>; | |||
fn complete(&mut self, input: &str, term: &Term, timout: Duration) -> std::io::Result<String>; |
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 seems like whether a timeout
is needed or not is dependent on the needs of the individual runtime. Should this be a function on them instead?
crates/completest-pty/src/lib.rs
Outdated
@@ -164,7 +169,7 @@ pub struct BashRuntime { | |||
path: OsString, | |||
home: PathBuf, | |||
config: PathBuf, | |||
timeout: Duration, | |||
_timeout: Duration, |
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.
if we keep timeout
on complete
, why would we keep these timeouts?
Pull Request Test Coverage Report for Build 10631733090Details
💛 - Coveralls |
Please update the name of the commit. A |
timeout: Duration, | ||
) -> std::io::Result<String> { | ||
let mut command = Command::new("zsh"); | ||
command.arg("--noglobalrcs"); | ||
command | ||
.env("PATH", &self.path) | ||
.env("TERM", "xterm") | ||
.env("ZDOTDIR", &self.home); | ||
let echo = false; | ||
comptest(command, echo, input, term, self.timeout) | ||
comptest(command, echo, input, term, timeout) |
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.
self.timeout
should be used
In a testing environment, exposing the timeout to users allows them to better configure their tests and avoid test failures caused by the built-in timeout being too short.