aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-02-23 12:38:21 -0500
committerJesse Luehrs <doy@tozt.net>2022-02-23 12:38:21 -0500
commit41412273dc38e55914224868b1bd26f0f17efc7d (patch)
tree25e98d8a57b477ba6c281f912f044b44b4ffb786
parent39287b07f87aba15c4cb0f64d7008ba67289151d (diff)
downloadpty-process-41412273dc38e55914224868b1bd26f0f17efc7d.tar.gz
pty-process-41412273dc38e55914224868b1bd26f0f17efc7d.zip
fix doc tests for non-async
-rw-r--r--src/lib.rs19
1 files 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