rust-cli / rexpect

.github/workflows/ci.yml
https://docs.rs/rexpect
MIT License
329 stars 58 forks source link

Timeout behavior is not the same as pexpect #122

Closed yancyribbens closed 6 months ago

yancyribbens commented 6 months ago

pexpect will eventually raise a timeout:

If nothing matches an expected pattern then expect() will eventually raise a TIMEOUT exception. The default time is 30 seconds, but you can change this by passing a timeout argument to expect():

It looks like rexpect does not timeout but hangs forever.

yancyribbens commented 6 months ago

Is there a way to make rexpect timeout in some way like pexpect?

d4h0 commented 6 months ago

@yancyribbens: From the docs of spawn:

timeout: If Some: all exp_* commands time out after x milliseconds, if None: never times out. It’s highly recommended to put a timeout there, as otherwise in case of a problem the program just hangs instead of exiting with an error message indicating where it stopped. For automation 30’000 (30s, the default in pexpect) is a good value.

yancyribbens commented 6 months ago

that works