mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
process: updated example (#3748)
This commit is contained in:
@@ -994,13 +994,22 @@ impl Child {
|
|||||||
/// If the caller wishes to explicitly control when the child's stdin
|
/// If the caller wishes to explicitly control when the child's stdin
|
||||||
/// handle is closed, they may `.take()` it before calling `.wait()`:
|
/// handle is closed, they may `.take()` it before calling `.wait()`:
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```
|
||||||
|
/// # #[cfg(not(unix))]fn main(){}
|
||||||
|
/// # #[cfg(unix)]
|
||||||
/// use tokio::io::AsyncWriteExt;
|
/// use tokio::io::AsyncWriteExt;
|
||||||
|
/// # #[cfg(unix)]
|
||||||
/// use tokio::process::Command;
|
/// use tokio::process::Command;
|
||||||
|
/// # #[cfg(unix)]
|
||||||
|
/// use std::process::Stdio;
|
||||||
///
|
///
|
||||||
|
/// # #[cfg(unix)]
|
||||||
/// #[tokio::main]
|
/// #[tokio::main]
|
||||||
/// async fn main() {
|
/// async fn main() {
|
||||||
/// let mut child = Command::new("cat").spawn().unwrap();
|
/// let mut child = Command::new("cat")
|
||||||
|
/// .stdin(Stdio::piped())
|
||||||
|
/// .spawn()
|
||||||
|
/// .unwrap();
|
||||||
///
|
///
|
||||||
/// let mut stdin = child.stdin.take().unwrap();
|
/// let mut stdin = child.stdin.take().unwrap();
|
||||||
/// tokio::spawn(async move {
|
/// tokio::spawn(async move {
|
||||||
|
|||||||
Reference in New Issue
Block a user