mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
process: Update Child::forget example to use the tokio runtime
This commit is contained in:
parent
5e9d60e834
commit
7b3e4b98ac
10
src/lib.rs
10
src/lib.rs
@ -436,27 +436,23 @@ impl Child {
|
|||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # extern crate futures;
|
/// # extern crate futures;
|
||||||
/// # extern crate tokio_core;
|
/// # extern crate tokio;
|
||||||
/// # extern crate tokio_process;
|
/// # extern crate tokio_process;
|
||||||
/// #
|
/// #
|
||||||
/// # use std::process::Command;
|
/// # use std::process::Command;
|
||||||
/// #
|
/// #
|
||||||
/// # use futures::Future;
|
/// # use futures::Future;
|
||||||
/// # use tokio_core::reactor::Core;
|
|
||||||
/// # use tokio_process::CommandExt;
|
/// # use tokio_process::CommandExt;
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// let core = Core::new().unwrap();
|
|
||||||
/// let handle = core.handle();
|
|
||||||
///
|
|
||||||
/// let child = Command::new("echo").arg("hello").arg("world")
|
/// let child = Command::new("echo").arg("hello").arg("world")
|
||||||
/// .spawn_async(&handle)
|
/// .spawn_async()
|
||||||
/// .expect("failed to spawn");
|
/// .expect("failed to spawn");
|
||||||
///
|
///
|
||||||
/// let do_cleanup = child.map(|_| ()) // Ignore result
|
/// let do_cleanup = child.map(|_| ()) // Ignore result
|
||||||
/// .map_err(|_| ()); // Ignore errors
|
/// .map_err(|_| ()); // Ignore errors
|
||||||
///
|
///
|
||||||
/// handle.spawn(do_cleanup);
|
/// tokio::spawn(do_cleanup);
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn forget(mut self) {
|
pub fn forget(mut self) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user