From 41412273dc38e55914224868b1bd26f0f17efc7d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 23 Feb 2022 12:38:21 -0500 Subject: fix doc tests for non-async --- src/lib.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ce8dc9e..e8b2e26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,10 +7,23 @@ //! The basic functionality looks like this: //! //! ```no_run -//! let mut pty = pty_process::Pty::new().unwrap(); -//! pty.resize(pty_process::Size::new(24, 80)).unwrap(); +//! # #[cfg(feature = "async")] +//! # #[tokio::main] +//! # async fn main() -> pty_process::Result<()> { +//! let mut pty = pty_process::Pty::new()?; +//! pty.resize(pty_process::Size::new(24, 80))?; //! let mut cmd = pty_process::Command::new("nethack"); -//! let child = cmd.spawn(&pty.pts().unwrap()).unwrap(); +//! let child = cmd.spawn(&pty.pts()?)?; +//! # Ok(()) +//! # } +//! # #[cfg(not(feature = "async"))] +//! # fn main() -> pty_process::Result<()> { +//! let mut pty = pty_process::blocking::Pty::new()?; +//! pty.resize(pty_process::Size::new(24, 80))?; +//! let mut cmd = pty_process::blocking::Command::new("nethack"); +//! let child = cmd.spawn(&pty.pts()?)?; +//! # Ok(()) +//! # } //! ``` //! //! The returned `child` is a normal instance of [`tokio::process::Child`] (or -- cgit v1.2.3-54-g00ecf