Struct cargo::util::process_builder::ProcessBuilder [−][src]
pub struct ProcessBuilder { /* fields omitted */ }
A builder object for an external process, similar to std::process::Command
.
Methods
impl ProcessBuilder
[src]
impl ProcessBuilder
pub fn program<T: AsRef<OsStr>>(&mut self, program: T) -> &mut ProcessBuilder
[src]
pub fn program<T: AsRef<OsStr>>(&mut self, program: T) -> &mut ProcessBuilder
(chainable) Set the executable for the process.
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut ProcessBuilder
[src]
pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut ProcessBuilder
(chainable) Add an arg to the args list.
pub fn args<T: AsRef<OsStr>>(&mut self, arguments: &[T]) -> &mut ProcessBuilder
[src]
pub fn args<T: AsRef<OsStr>>(&mut self, arguments: &[T]) -> &mut ProcessBuilder
(chainable) Add many args to the args list.
pub fn args_replace<T: AsRef<OsStr>>(
&mut self,
arguments: &[T]
) -> &mut ProcessBuilder
[src]
pub fn args_replace<T: AsRef<OsStr>>(
&mut self,
arguments: &[T]
) -> &mut ProcessBuilder
(chainable) Replace args with new args list
pub fn cwd<T: AsRef<OsStr>>(&mut self, path: T) -> &mut ProcessBuilder
[src]
pub fn cwd<T: AsRef<OsStr>>(&mut self, path: T) -> &mut ProcessBuilder
(chainable) Set the current working directory of the process
pub fn env<T: AsRef<OsStr>>(&mut self, key: &str, val: T) -> &mut ProcessBuilder
[src]
pub fn env<T: AsRef<OsStr>>(&mut self, key: &str, val: T) -> &mut ProcessBuilder
(chainable) Set an environment variable for the process.
pub fn env_remove(&mut self, key: &str) -> &mut ProcessBuilder
[src]
pub fn env_remove(&mut self, key: &str) -> &mut ProcessBuilder
(chainable) Unset an environment variable for the process.
pub fn get_program(&self) -> &OsString
[src]
pub fn get_program(&self) -> &OsString
Get the executable name.
pub fn get_args(&self) -> &[OsString]
[src]
pub fn get_args(&self) -> &[OsString]
Get the program arguments
pub fn get_cwd(&self) -> Option<&Path>
[src]
pub fn get_cwd(&self) -> Option<&Path>
Get the current working directory for the process
pub fn get_env(&self, var: &str) -> Option<OsString>
[src]
pub fn get_env(&self, var: &str) -> Option<OsString>
Get an environment variable as the process will see it (will inherit from environment unless explicitally unset).
pub fn get_envs(&self) -> &HashMap<String, Option<OsString>>
[src]
pub fn get_envs(&self) -> &HashMap<String, Option<OsString>>
Get all environment variables explicitly set or unset for the process (not inherited vars).
ⓘImportant traits for &'a mut Rpub fn inherit_jobserver(&mut self, jobserver: &Client) -> &mut Self
[src]
pub fn inherit_jobserver(&mut self, jobserver: &Client) -> &mut Self
Set the make
jobserver. See the jobserver crate for
more information.
pub fn exec(&self) -> CargoResult<()>
[src]
pub fn exec(&self) -> CargoResult<()>
Run the process, waiting for completion, and mapping non-success exit codes to an error.
pub fn exec_replace(&self) -> CargoResult<()>
[src]
pub fn exec_replace(&self) -> CargoResult<()>
On unix, executes the process using the unix syscall execvp
, which will block this
process, and will only return if there is an error. On windows this is a synonym for
exec
.
pub fn exec_with_output(&self) -> CargoResult<Output>
[src]
pub fn exec_with_output(&self) -> CargoResult<Output>
Execute the process, returning the stdio output, or an error if non-zero exit status.
pub fn exec_with_streaming(
&self,
on_stdout_line: &mut FnMut(&str) -> CargoResult<()>,
on_stderr_line: &mut FnMut(&str) -> CargoResult<()>,
print_output: bool
) -> CargoResult<Output>
[src]
pub fn exec_with_streaming(
&self,
on_stdout_line: &mut FnMut(&str) -> CargoResult<()>,
on_stderr_line: &mut FnMut(&str) -> CargoResult<()>,
print_output: bool
) -> CargoResult<Output>
Execute a command, passing each line of stdout and stderr to the supplied callbacks, which can mutate the string data.
If any invocations of these function return an error, it will be propagated.
Optionally, output can be passed to errors using print_output
pub fn build_command(&self) -> Command
[src]
pub fn build_command(&self) -> Command
Converts ProcessBuilder into a std::process::Command
, and handles the jobserver if
present.
Trait Implementations
impl Clone for ProcessBuilder
[src]
impl Clone for ProcessBuilder
fn clone(&self) -> ProcessBuilder
[src]
fn clone(&self) -> ProcessBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for ProcessBuilder
[src]
impl Debug for ProcessBuilder
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for ProcessBuilder
[src]
impl Display for ProcessBuilder
Auto Trait Implementations
impl Send for ProcessBuilder
impl Send for ProcessBuilder
impl Sync for ProcessBuilder
impl Sync for ProcessBuilder