diff options
Diffstat (limited to 'examples/pty.rs')
-rw-r--r-- | examples/pty.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/pty.rs b/examples/pty.rs new file mode 100644 index 0000000..d5b5a88 --- /dev/null +++ b/examples/pty.rs @@ -0,0 +1,25 @@ +use futures::future::{Future, IntoFuture}; +use tokio_pty_process::CommandExt; + +fn main() { + tokio::run(futures::future::lazy(move || { + let master = tokio_pty_process::AsyncPtyMaster::open().unwrap(); + let args: Vec<&str> = vec![]; + let child = std::process::Command::new("false") + .args(&args) + .spawn_pty_async(&master) + .unwrap(); + tokio::spawn( + child + .map(|status| { + eprintln!("got status {}", status); + () + }) + .map_err(|_| ()), + ) + .into_future() + .wait() + .unwrap(); + futures::future::ok(()) + })); +} |