#[non_exhaustive]pub struct SubprocessSpec {
pub mode: SubprocessMode,
pub env: TaskEnv,
pub cwd: Option<PathBuf>,
pub fail_on_non_zero: Flag,
}Expand description
Specification for subprocess execution on the host.
Supports two execution strategies via SubprocessMode:
- command: direct binary execution;
- script: script body passed to an explicit interpreter.
Common fields (env, cwd, fail_on_non_zero) apply to both modes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.mode: SubprocessModeExecution strategy (command or script).
env: TaskEnvEnvironment variables for the process.
cwd: Option<PathBuf>Working directory.
fail_on_non_zero: FlagWhether to treat non-zero exit codes as task failure.
When enabled (default), any non-zero exit code will be reported as a failure.
Implementations§
Source§impl SubprocessSpec
impl SubprocessSpec
Sourcepub fn new(
mode: SubprocessMode,
env: TaskEnv,
cwd: Option<PathBuf>,
fail_on_non_zero: Flag,
) -> Self
pub fn new( mode: SubprocessMode, env: TaskEnv, cwd: Option<PathBuf>, fail_on_non_zero: Flag, ) -> Self
Creates a subprocess spec.
SubprocessSpec is #[non_exhaustive].
Use this constructor outside the crate.
Validation occurs when the workload enters a crate::TaskSpec.
§Example
use solti_model::{Flag, SubprocessMode, SubprocessSpec, TaskEnv};
let spec = SubprocessSpec::new(
SubprocessMode::Command {
command: "echo".into(),
args: vec!["hello".into()],
},
TaskEnv::default(),
None,
Flag::enabled(),
);
assert!(spec.fail_on_non_zero.is_enabled());Trait Implementations§
Source§impl Clone for SubprocessSpec
impl Clone for SubprocessSpec
Source§fn clone(&self) -> SubprocessSpec
fn clone(&self) -> SubprocessSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SubprocessSpec
impl Debug for SubprocessSpec
Source§impl<'de> Deserialize<'de> for SubprocessSpec
impl<'de> Deserialize<'de> for SubprocessSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SubprocessSpec
Source§impl JsonSchema for SubprocessSpec
impl JsonSchema for SubprocessSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for SubprocessSpec
impl PartialEq for SubprocessSpec
Source§impl Serialize for SubprocessSpec
impl Serialize for SubprocessSpec
impl StructuralPartialEq for SubprocessSpec
Auto Trait Implementations§
impl Freeze for SubprocessSpec
impl RefUnwindSafe for SubprocessSpec
impl Send for SubprocessSpec
impl Sync for SubprocessSpec
impl Unpin for SubprocessSpec
impl UnsafeUnpin for SubprocessSpec
impl UnwindSafe for SubprocessSpec
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
Mutably borrows from an owned value. Read more