pub struct CommandProcess {
pub environment: HashMap<String, String>,
pub step: XvcStep,
pub step_command: XvcStepCommand,
pub birth: Option<Instant>,
pub process: Option<Popen>,
pub stdout_sender: Sender<String>,
pub stderr_sender: Sender<String>,
pub stdout_receiver: Receiver<String>,
pub stderr_receiver: Receiver<String>,
}
Expand description
Used for encapsulating a process and its outputs. This is used to associate steps with running processes.
Fields§
§environment: HashMap<String, String>
Environment variables injected to the shell that runs the command. This is used to pass added, removed items in certain dependency types.
step: XvcStep
The step that this command belongs to
step_command: XvcStepCommand
The command to run
birth: Option<Instant>
When we started running the command
process: Option<Popen>
The process that runs the command
stdout_sender: Sender<String>
Channel to send stdout to
stderr_sender: Sender<String>
Channel to send stderr to
stdout_receiver: Receiver<String>
Channel to receive stdout from
stderr_receiver: Receiver<String>
Channel to receive stderr from
Implementations§
Source§impl CommandProcess
impl CommandProcess
Sourcepub fn new(step: &XvcStep, step_command: &XvcStepCommand) -> Self
pub fn new(step: &XvcStep, step_command: &XvcStepCommand) -> Self
Create a new CommandProcess by creating channels and setting other variables to their default values.
Sourcepub fn add_environment_variable(
&mut self,
key: &str,
value: &str,
) -> Result<&mut Self>
pub fn add_environment_variable( &mut self, key: &str, value: &str, ) -> Result<&mut Self>
Add an environment variable to inject to the shell that runs the command.
Sourcepub fn run(&mut self) -> Result<()>
pub fn run(&mut self) -> Result<()>
Start executing the command in a shell. Updates birth and process variables after detaching.
Sourcepub fn update_output_channels(&mut self) -> Result<()>
pub fn update_output_channels(&mut self) -> Result<()>
Collects the output from process and sends to output channels.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandProcess
impl RefUnwindSafe for CommandProcess
impl Send for CommandProcess
impl Sync for CommandProcess
impl Unpin for CommandProcess
impl UnwindSafe for CommandProcess
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> 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