pub struct DeclaredCommandAction { /* private fields */ }Expand description
A declared command, ready to run as an activity.
Implementations§
Source§impl DeclaredCommandAction
impl DeclaredCommandAction
Sourcepub const fn new(contract: DeclaredCommandContract) -> Self
pub const fn new(contract: DeclaredCommandContract) -> Self
Wrap an emitted command.
Sourcepub fn declared_working_directory(&self) -> Option<&str>
pub fn declared_working_directory(&self) -> Option<&str>
The working directory the DECLARATION states, verbatim.
Returned unexpanded because a {workspace_root} placeholder resolves
against the executing host’s own workspace, which this crate has no
business knowing. A caller reads this, resolves it however its host
resolves roots, and hands the answer back through
Self::with_working_directory.
Sourcepub fn with_working_directory(self, directory: impl Into<PathBuf>) -> Self
pub fn with_working_directory(self, directory: impl Into<PathBuf>) -> Self
Run the command in directory.
Sourcepub fn declared_timeout(&self) -> Result<Option<Duration>, ActivityFailure>
pub fn declared_timeout(&self) -> Result<Option<Duration>, ActivityFailure>
The timeout the declaration states, if it states one.
Ok(None) means the declaration stated NONE, which is a legal declared
state: nothing here substitutes a ceiling.
§Errors
Returns a terminal ActivityFailure when the contract carries a
millisecond count no duration can hold — a negative one, say. The AWL
checker refuses those before deploy, so reaching this arm means a
defective contract was deployed; it is REFUSED rather than treated as
“no ceiling”, because the direction of that failure is a command
running unbounded on the operator’s machine while the declaration, the
--check report and the named owner all say a bound was set.
Sourcepub fn timeout_owner(&self) -> Option<&str>
pub fn timeout_owner(&self) -> Option<&str>
Who owns the declared timeout, when there is one.
Sourcepub fn render(
&self,
arguments: &BTreeMap<String, Value>,
) -> Result<RenderedCommand, ActivityFailure>
pub fn render( &self, arguments: &BTreeMap<String, Value>, ) -> Result<RenderedCommand, ActivityFailure>
Render this command against arguments.
arguments is the ACTION’s whole input and may name parameters the
command does not use — an action is free to declare more than one of
its bodies needs. The command’s own declared names select from it, so
a surplus is not a refusal here; a command parameter the action cannot
supply is refused at check time, before anything is deployed.
§Errors
Returns a terminal ActivityFailure when a value has no unambiguous
argument form, when a declared parameter has neither a supplied value
nor a default, or when an operand would carry leading-dash bytes into a
position the program still reads options in. Every one of those fails
identically on every retry, which is why none is retryable.
Sourcepub async fn run(
&self,
arguments: &BTreeMap<String, Value>,
context: &ActivityContext,
) -> Result<ShellOutcome, ActivityFailure>
pub async fn run( &self, arguments: &BTreeMap<String, Value>, context: &ActivityContext, ) -> Result<ShellOutcome, ActivityFailure>
Run the command with arguments bound to its declared parameters.
Two things end the command early and both reach the same termination
ladder the string-body executor uses — SIGTERM → grace → SIGKILL
across the whole process group, with the verdict withheld until the
group has been proven gone. The first is the activity being cancelled.
The second is the command’s OWN declared timeout, which is enforced
here, where the process is: a deadline applied only to the waiting side
stops a caller waiting and leaves a process running.
§Errors
Returns a terminal ActivityFailure for a render refusal, a command
that cannot be spawned or observed, a cancellation, or a declared
timeout; and a retryable one for a non-zero exit, carrying the exit
code and the command’s own standard error.
Trait Implementations§
Source§impl Clone for DeclaredCommandAction
impl Clone for DeclaredCommandAction
Source§fn clone(&self) -> DeclaredCommandAction
fn clone(&self) -> DeclaredCommandAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DeclaredCommandAction
impl RefUnwindSafe for DeclaredCommandAction
impl Send for DeclaredCommandAction
impl Sync for DeclaredCommandAction
impl Unpin for DeclaredCommandAction
impl UnsafeUnpin for DeclaredCommandAction
impl UnwindSafe for DeclaredCommandAction
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request