stemjail / tty-rs

Pseudoterminal Rust library
https://stemjail.github.io/rustdoc/tty/
GNU General Public License v3.0
29 stars 9 forks source link

Tokio integration #6

Open little-dude opened 6 years ago

little-dude commented 6 years ago

Hi,

I'm trying to write an expect crate. The problem is, I want non-blocking IO on the master pty, so that I can implement timeouts. For now, I copy-pasted the TtyServer implementation and made the tokio integration: https://github.com/little-dude/expect-rs/blob/master/src/pty.rs.

Do you think this kind of stuff would be worth adding to tty-rs as a separte type, like AsyncTtyServer ?

Thanks for this crate, I learnt a lot just about ttys just by reading your code :)

mikroskeem commented 6 years ago

Bump, any updates on this? @little-dude's code is gone as well somewhere

little-dude commented 6 years ago

@mikroskeem it's here: https://github.com/little-dude/expect-rs/blob/81d5dc2efa2dcb4da82667b83145b74f1ac78e8a/src/core/pty.rs#L90-L155

mikroskeem commented 6 years ago

Oh thank you, forgive my laziness :smile:

little-dude commented 6 years ago

I'm glad if it's helpful :)

l0kod commented 6 years ago

I missed this issue. :/

Do you think this kind of stuff would be worth adding to tty-rs as a separte type, like AsyncTtyServer ?

Yes, that would be great! :)

You may need to add a feature gate for the Tokio dependency, though.

However, tty-rs is not MIT. ;)

little-dude commented 6 years ago

However, tty-rs is not MIT. ;)

Oh, I hadn't noticed. If I use it as a dependency, I need to license my crate under GPL instead of MIT then, right?