pub enum CommandState {
Pending,
Running {
child: Box<dyn TokioChildWrapper>,
started: Instant,
},
Finished {
status: ProcessEnd,
started: Instant,
finished: Instant,
},
}Expand description
The state of the job’s command / process.
This is used both internally to represent the current state (ready/pending, running, finished)
of the command, and can be queried via the JobTaskContext by hooks.
Technically, some operations can be done through a &self shared borrow on the running
command’s TokioChildWrapper, but this library recommends against taking advantage of this,
and prefer using the methods on Job instead, so that the job can keep track of
what’s going on.
Variants§
Pending
The command is neither running nor has finished. This is the initial state.
Running
The command is currently running. Note that this is established after the process is spawned
and not precisely synchronised with the process’ aliveness: in some cases the process may be
exited but still Running in this enum.
Fields
child: Box<dyn TokioChildWrapper>The child process.
Finished
The command has completed and its status was collected.
Implementations§
Source§impl CommandState
impl CommandState
Sourcepub const fn is_pending(&self) -> bool
pub const fn is_pending(&self) -> bool
Whether the command is pending, i.e. not running or finished.
Sourcepub const fn is_running(&self) -> bool
pub const fn is_running(&self) -> bool
Whether the command is running.
Sourcepub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Whether the command is finished.