Struct chainsop::SubProcOperation
source · pub struct SubProcOperation { /* private fields */ }
Expand description
This structure represents a single command to run as a sub-process, the command’s arguments, and the input and output files for that sub-process. The structure itself is public but the fields are private (i.e. implementation specific); the impl section below defines the visible operations that can be performed on this structure.
Implementations§
source§impl SubProcOperation
impl SubProcOperation
sourcepub fn new(executing: &Executable) -> SubProcOperation
pub fn new(executing: &Executable) -> SubProcOperation
This is the primary method of initializing a SubProcOperation.
sourcepub fn set_executable<T>(&mut self, exe: T) -> &mut Selfwhere
T: Into<PathBuf>,
pub fn set_executable<T>(&mut self, exe: T) -> &mut Selfwhere T: Into<PathBuf>,
Changes the name of the command to execute.
sourcepub fn clear_env(&mut self) -> &mut Self
pub fn clear_env(&mut self) -> &mut Self
Clears all environment variable settings for the environment in which this operation executes. Any previous environment variable settings are discarded.
By default, the current environment is inherited by the operation.
sourcepub fn set_env<N, V>(&mut self, var_name: N, var_value: V) -> &mut Selfwhere
N: Into<String>,
V: Into<String>,
pub fn set_env<N, V>(&mut self, var_name: N, var_value: V) -> &mut Selfwhere N: Into<String>, V: Into<String>,
Specifies an environment variable value to be set in the environment for executing this operation. This can be used multiple times to set multiple environment variables; subsequent settings of the same variable will override previous settings.
The first argument is the environment variable name and the second argument is the value to set for that variable.
sourcepub fn prepend_env<N, V, S>(&mut self, var: N, value: V, sep: S) -> &mut Selfwhere
N: Into<String>,
V: Into<String>,
S: Into<String>,
pub fn prepend_env<N, V, S>(&mut self, var: N, value: V, sep: S) -> &mut Selfwhere N: Into<String>, V: Into<String>, S: Into<String>,
Extends the operations environment by prepending a value to an environment variable. If the environment variable was not previously set, this becomes the new value for that variable. This can be used multiple times to extend the environment variable with multiple values.
The first argument is the environment variable name and the second argument is the value to prepend to that variable, and the third value is the separator between the prepended value and the existing value.
sourcepub fn append_env<N, V, S>(&mut self, var: N, value: V, sep: S) -> &mut Selfwhere
N: Into<String>,
V: Into<String>,
S: Into<String>,
pub fn append_env<N, V, S>(&mut self, var: N, value: V, sep: S) -> &mut Selfwhere N: Into<String>, V: Into<String>, S: Into<String>,
Extends the operations environment by appending a value to an environment variable. If the environment variable was not previously set, this becomes the new value for that variable. This can be used multiple times to extend the environment variable with multiple values.
The first argument is the environment variable name and the second argument is the value to append to that variable, and the third value is the separator between the appended value and the existing value.
sourcepub fn unset_env<N>(&mut self, var_name: N) -> &mut Selfwhere
N: Into<String>,
pub fn unset_env<N>(&mut self, var_name: N) -> &mut Selfwhere N: Into<String>,
Removes the specified environment variable from the environment in which the operation executes. Has no effect but does not fail if the environment variable does not exist.
sourcepub fn push_arg<T>(&mut self, arg: T) -> &mut Selfwhere
T: Into<OsString>,
pub fn push_arg<T>(&mut self, arg: T) -> &mut Selfwhere T: Into<OsString>,
Adds an argument to use when executing the operation. This can, for example, be used for specifying command-line option arguments when running a subprocess Executable operation. Each operation type and instance can determine how it will handle any specified arguments.
Trait Implementations§
source§impl Clone for SubProcOperation
impl Clone for SubProcOperation
source§fn clone(&self) -> SubProcOperation
fn clone(&self) -> SubProcOperation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SubProcOperation
impl Debug for SubProcOperation
source§impl FilesPrep for SubProcOperation
impl FilesPrep for SubProcOperation
source§fn set_dir<T>(&mut self, tgtdir: T) -> &mut Selfwhere
T: AsRef<Path>,
fn set_dir<T>(&mut self, tgtdir: T) -> &mut Selfwhere T: AsRef<Path>,
FileArg::Loc
paths are
valid when operating from that directory. This directory is usually a
relative directory and is interpreted from the current working directory
or the directory provided to the OpInterface::execute
method.source§fn set_input_file(&mut self, fname: &FileArg) -> &mut Self
fn set_input_file(&mut self, fname: &FileArg) -> &mut Self
source§fn add_input_file(&mut self, fname: &FileArg) -> &mut Self
fn add_input_file(&mut self, fname: &FileArg) -> &mut Self
source§fn has_input_file(&self) -> bool
fn has_input_file(&self) -> bool
source§fn set_output_file(&mut self, fname: &FileArg) -> &mut Self
fn set_output_file(&mut self, fname: &FileArg) -> &mut Self
source§fn has_explicit_output_file(&self) -> bool
fn has_explicit_output_file(&self) -> bool
source§impl OpInterface for SubProcOperation
impl OpInterface for SubProcOperation
source§fn label(&self) -> String
fn label(&self) -> String
source§fn set_label(&mut self, new_label: &str) -> &mut Self
fn set_label(&mut self, new_label: &str) -> &mut Self
source§fn execute<Exec, P>(
&mut self,
executor: &Exec,
cwd: &Option<P>
) -> Result<ActualFile>where
P: AsRef<Path>,
Exec: OsRun,
fn execute<Exec, P>( &mut self, executor: &Exec, cwd: &Option<P> ) -> Result<ActualFile>where P: AsRef<Path>, Exec: OsRun,
NamedFile
values.
The successful result specifies the output file written (if any). Read more