pub struct ExecSpec {
pub working_dir: PathBuf,
pub executable: OsString,
pub clargs: Vec<OsString>,
pub env: HashMap<String, String>,
pub input: Input,
pub output: Output,
pub output_err: Output,
}
Expand description
The exec spec helps define something to execute by the project
Fields§
§working_dir: PathBuf
The working directory to run the executable in
executable: OsString
The executable
clargs: Vec<OsString>
The command line args for the executable
env: HashMap<String, String>
The environment variables for the executable.
§Warning
ONLY the environment variables in this map will be passed to the executable.
input: Input
The input to the program, if needed
output: Output
Where the program’s stdout is emitted
output_err: Output
Where the program’s stderr is emitted
Implementations§
Source§impl ExecSpec
impl ExecSpec
Sourcepub fn working_dir(&self) -> &Path
pub fn working_dir(&self) -> &Path
The working directory of the exec spec. If the path is relative, then the relative path is calculated relative to the the base directory of a project.
Sourcepub fn executable(&self) -> &OsStr
pub fn executable(&self) -> &OsStr
The executable to run
Sourcepub fn execute_spec<P>(self, path: P) -> ProjectResult<ExecHandle>
pub fn execute_spec<P>(self, path: P) -> ProjectResult<ExecHandle>
Try to executes an exec-spec, using the given path to resolve the current directory. If creating the program is successful, returns an
ExecSpecHandle
. This is a non-blocking method, as the actual
command is ran in a separate thread.
Execution of the spec begins as soon as this method is called. However, all scheduling is controlled by the OS.
§Error
This method will return an error if the given path can not be canonicalized into an absolute path, or the executable specified by this spec does not exist.
Sourcepub fn finish(&mut self) -> Result<ExitStatus>
👎Deprecated
pub fn finish(&mut self) -> Result<ExitStatus>
Waits for the running child process to finish. Will return Some(exit_status)
only
if a child process has already been started. Otherwise, a None
result will be given
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExecSpec
impl RefUnwindSafe for ExecSpec
impl Send for ExecSpec
impl Sync for ExecSpec
impl Unpin for ExecSpec
impl UnwindSafe for ExecSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InstanceOf for T
impl<T> InstanceOf for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more