From 4d11784b0177cce17c2341ce0a27be6ce2788b35 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Apr 2017 14:02:51 -0700 Subject: [PATCH] process: Tweak docs and macro imports --- Cargo.toml | 2 +- src/lib.rs | 14 +++++--------- tests/stdio.rs | 1 - 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 56e222408..82e8df1af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,13 +17,13 @@ appveyor = { repository = "alexcrichton/tokio-process" } [dependencies] futures = "0.1.11" -log = "0.3" mio = "0.6.5" tokio-core = "0.1.6" tokio-io = "0.1" [dev-dependencies] env_logger = { version = "0.3", default-features = false } +log = "0.3" [target.'cfg(windows)'.dependencies] winapi = "0.2" diff --git a/src/lib.rs b/src/lib.rs index ace0dbe13..aa15624df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,13 +79,13 @@ //! extern crate tokio_io; //! //! use std::io; -//! use std::process::{Command, Stdio, Output}; +//! use std::process::{Command, Stdio, ExitStatus}; //! //! use futures::{BoxFuture, Future, Stream}; //! use tokio_core::reactor::Core; //! use tokio_process::{CommandExt, Child}; //! -//! fn get_lines(mut cat: Child) -> BoxFuture<((), Output), io::Error> { +//! fn print_lines(mut cat: Child) -> BoxFuture { //! let stdout = cat.stdout().take().unwrap(); //! let reader = io::BufReader::new(stdout); //! let lines = tokio_io::io::lines(reader); @@ -93,17 +93,16 @@ //! println!("Line: {}", l); //! Ok(()) //! }); -//! cycle.join(cat.wait_with_output()).boxed() +//! cycle.join(cat).map(|((), s)| s).boxed() //! } //! //! fn main() { +//! let mut core = Core::new().unwrap(); //! let mut cmd = Command::new("cat"); //! let mut cat = cmd.stdout(Stdio::piped()); -//! let mut core = Core::new().unwrap(); //! let child = cat.spawn_async(&core.handle()).unwrap(); -//! core.run(get_lines(child)).unwrap(); +//! core.run(print_lines(child)).unwrap(); //! } -//! //! ``` //! //! # Caveats @@ -119,13 +118,10 @@ #![deny(missing_docs)] #![doc(html_root_url = "https://docs.rs/tokio-process/0.1")] -#[macro_use] extern crate futures; extern crate tokio_core; extern crate tokio_io; extern crate mio; -#[macro_use] -extern crate log; use std::ffi::OsStr; use std::io::{self, Read, Write}; diff --git a/tests/stdio.rs b/tests/stdio.rs index e1353ec1f..bd0cdee29 100644 --- a/tests/stdio.rs +++ b/tests/stdio.rs @@ -1,5 +1,4 @@ extern crate futures; -#[macro_use] extern crate tokio_core; extern crate tokio_io; extern crate tokio_process;