aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-06-09 00:55:53 -0400
committerJesse Luehrs <doy@tozt.net>2019-06-09 01:05:53 -0400
commitc383570c75d9757f405b2e43ab48f458759b1403 (patch)
treeeebc7e4f4e8587feba1c2d9643df8f148463e24c /examples
parent59abbab62e936a46ceea7bb7ebac5ca9ef4ba2da (diff)
downloadnbsh-old-c383570c75d9757f405b2e43ab48f458759b1403.tar.gz
nbsh-old-c383570c75d9757f405b2e43ab48f458759b1403.zip
implement process running
Diffstat (limited to 'examples')
-rw-r--r--examples/pty.rs25
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(())
+ }));
+}