#tokio #child-process #pty #interact #pseudotty #pseudo-tty

tokio-pty-process

Interact with a child process through a pseudo-TTY, asynchronously using Tokio

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

Download history 1025/week @ 2024-07-19 1331/week @ 2024-07-26 760/week @ 2024-08-02 1258/week @ 2024-08-09 1174/week @ 2024-08-16 1483/week @ 2024-08-23 1376/week @ 2024-08-30 1605/week @ 2024-09-06 1773/week @ 2024-09-13 713/week @ 2024-09-20 153/week @ 2024-09-27 164/week @ 2024-10-04 114/week @ 2024-10-11 83/week @ 2024-10-18 61/week @ 2024-10-25 89/week @ 2024-11-01

359 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

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.

This project is copyright its authors and licensed under either of

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:

  1. Create a Tokio Reactor that will handle all of your asynchronous I/O.
  2. Create an AsyncPtyMaster that represents your ownership of an OS pseudo-terminal.
  3. Use your master and the spawn_pty_async or spawn_pty_async_raw functions of the CommandExt extension trait, which extends std::process::Command, to launch a child process that is connected to your master.
  4. 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