From c383570c75d9757f405b2e43ab48f458759b1403 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 9 Jun 2019 00:55:53 -0400 Subject: implement process running --- examples/pty.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/pty.rs (limited to 'examples') 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(()) + })); +} -- cgit v1.2.3-54-g00ecf