#tokio #pseudotty


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

#665 in Unix APIs

Download history 39/week @ 2023-08-16 28/week @ 2023-08-23 26/week @ 2023-08-30 43/week @ 2023-09-06 31/week @ 2023-09-13 25/week @ 2023-09-20 32/week @ 2023-09-27 26/week @ 2023-10-04 28/week @ 2023-10-11 40/week @ 2023-10-18 36/week @ 2023-10-25 45/week @ 2023-11-01 51/week @ 2023-11-08 43/week @ 2023-11-15 59/week @ 2023-11-22 41/week @ 2023-11-29

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


512 lines


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.


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.


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.


~87K SLoC