diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-02-23 12:38:21 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-02-23 12:38:21 -0500 |
commit | 41412273dc38e55914224868b1bd26f0f17efc7d (patch) | |
tree | 25e98d8a57b477ba6c281f912f044b44b4ffb786 | |
parent | 39287b07f87aba15c4cb0f64d7008ba67289151d (diff) | |
download | pty-process-41412273dc38e55914224868b1bd26f0f17efc7d.tar.gz pty-process-41412273dc38e55914224868b1bd26f0f17efc7d.zip |
fix doc tests for non-async
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -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 |