6 releases (3 breaking)
Uses old Rust 2015
0.4.0 | Jun 5, 2019 |
---|---|
0.3.2 | Apr 17, 2019 |
0.3.1 | Dec 29, 2018 |
0.3.0 | Oct 11, 2018 |
0.1.0 | May 27, 2018 |
#795 in Unix APIs
359 downloads per month
Used in 4 crates
(3 directly)
33KB
512 lines
tokio-pty-process
Spawn a child process that is connected to a pseudo-TTY, interacting with it asynchronously using Tokio.
This code is essentially a mashup of tokio-process and pty-rs. It is more strongly derived from the former.
Copyright and license
This project is copyright its authors and licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in tokio-pty-process
by you, as defined in the
Apache-2.0 license, shall be dual licensed as above, without any additional
terms or conditions.
lib.rs
:
Spawn a child process under a pseudo-TTY, interacting with it asynchronously using Tokio.
A pseudo-terminal (or “pseudo-TTY” or “PTY”) is a special Unix file handle that models the kind of text terminal through which users used to interact with computers. A PTY enables a specialized form of bidirectional interprocess communication that a variety of user-facing Unix programs take advantage of.
The basic way to use this crate is:
- Create a Tokio Reactor that will handle all of your asynchronous I/O.
- Create an
AsyncPtyMaster
that represents your ownership of an OS pseudo-terminal. - Use your master and the
spawn_pty_async
orspawn_pty_async_raw
functions of theCommandExt
extension trait, which extendsstd::process::Command
, to launch a child process that is connected to your master. - Optionally control the child process (e.g. send it signals) through the
Child
value returned by that function.
This crate only works on Unix since pseudo-terminals are a Unix-specific concept.
The Child
type is largely copied from Alex Crichton’s
tokio-process crate.
Dependencies
~6MB
~93K SLoC