From 39287b07f87aba15c4cb0f64d7008ba67289151d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 22 Feb 2022 17:02:12 -0500 Subject: another rewrite --- src/lib.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index a4bb412..ce8dc9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ -//! This crate is a wrapper around [`std::process::Command`] or -//! [`async_process::Command`] which provides the ability to allocate a pty +//! This crate is a wrapper around [`tokio::process::Command`] or +//! [`std::process::Command`] which provides the ability to allocate a pty //! and spawn new processes attached to that pty, with the pty as their //! controlling terminal. This allows for manipulation of interactive //! programs. @@ -10,25 +10,23 @@ //! let mut pty = pty_process::Pty::new().unwrap(); //! pty.resize(pty_process::Size::new(24, 80)).unwrap(); //! let mut cmd = pty_process::Command::new("nethack"); -//! let child = cmd.spawn(&pty).unwrap(); +//! let child = cmd.spawn(&pty.pts().unwrap()).unwrap(); //! ``` //! -//! The returned `child` is a normal instance of [`async_process::Child`] (or +//! The returned `child` is a normal instance of [`tokio::process::Child`] (or //! [`std::process::Child`] for the [`blocking`](crate::blocking) variant), //! with its `stdin`/`stdout`/`stderr` file descriptors pointing at the given -//! pty. The `pty` instance implements [`std::io::Read`] and -//! [`std::io::Write`] (or [`futures_io::AsyncRead`] and -//! [`futures_io::AsyncWrite`] for the [`blocking`] variant), and can be used -//! to communicate with the child process. The child process will also be made -//! a session leader of a new session, and the controlling terminal of that -//! session will be set to the given pty. +//! pty. The `pty` instance implements [`tokio::io::AsyncRead`] and +//! [`tokio::io::AsyncWrite`] (or [`std::io::Read`] and [`std::io::Write`] for +//! the [`blocking`] variant), and can be used to communicate with the child +//! process. The child process will also be made a session leader of a new +//! session, and the controlling terminal of that session will be set to the +//! given pty. //! //! # Features //! //! By default, only the [`blocking`](crate::blocking) APIs are available. To -//! include the asynchronous APIs, you must enable the `async` feature. See -//! the `examples` directory in the repository for examples of how to use this -//! crate with the various different asynchronous frameworks. +//! include the asynchronous APIs, you must enable the `async` feature. #![warn(clippy::cargo)] #![warn(clippy::pedantic)] @@ -59,4 +57,4 @@ pub use command::Command; #[cfg(feature = "async")] mod pty; #[cfg(feature = "async")] -pub use pty::Pty; +pub use pty::{OwnedReadPty, OwnedWritePty, Pts, Pty, ReadPty, WritePty}; -- cgit v1.2.3-54-g00ecf