Struct bitflags::__core::process::Child [] [src]

pub struct Child {
    pub stdin: Option<ChildStdin>,
    pub stdout: Option<ChildStdout>,
    pub stderr: Option<ChildStderr>,
    // some fields omitted
}
1.0.0
[]

Representation of a running or exited child process.

This structure is used to represent and manage child processes. A child process is created via the Command struct, which configures the spawning process and can itself be constructed using a builder-style interface.

Examples

use std::process::Command;

let mut child = Command::new("/bin/cat")
                        .arg("file.txt")
                        .spawn()
                        .unwrap_or_else(|e| { panic!("failed to execute child: {}", e) });

let ecode = child.wait()
                 .unwrap_or_else(|e| { panic!("failed to wait on child: {}", e) });

assert!(ecode.success());

Note

Take note that there is no implementation of Drop for child processes, so if you do not ensure the Child has exited then it will continue to run, even after the Child handle to the child process has gone out of scope.

Calling wait (or other functions that wrap around it) will make the parent process wait until the child has actually exited before continuing.

Fields

stdin

The handle for writing to the child's stdin, if it has been captured

stdout

The handle for reading from the child's stdout, if it has been captured

stderr

The handle for reading from the child's stderr, if it has been captured