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 DOCUMENT 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 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 element in option position would open with
leading-dash bytes. 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:
every body line in order, stopping at the first line that does not exit
zero, the stdout of the lines concatenated into one outcome.
Cancellation reaches the line that is running through the same
termination ladder the string-body executor uses — SIGTERM → grace →
SIGKILL across the process group, with the verdict withheld until
the group has been proven gone — and no later line starts: the
cancellation is read at the top of the loop, before each line is handed
over, so a cancellation that landed while the previous line was
finishing stops the body instead of starting the next program.
The residual window is stated rather than claimed away: a cancellation
landing between that read and the execve still starts that one line,
which is then terminated by the ladder above. There is no moment
between “decide to run” and “the kernel has run it” that this side can
hold, so what an operator may rely on is that a cancellation already
standing when a line is reached runs no part of that line or any after
it.
That the ladder fires AT ALL for such a cancellation rests on
ActivityContext::cancelled, whose future is created here before the
line is spawned and which registers its interest before it reads the
flag: a cancellation landing anywhere after that future exists reaches
the select that the ladder hangs off. A waiter that read the flag
first would have a window in which the signal is spent on nobody, and
this line would run to completion with the cancellation standing.
§Errors
Returns a terminal ActivityFailure for a command whose body renders
no line at all, for a render refusal, for a line that cannot be spawned
or observed, for a line whose ending this host cannot read (see
[super::failure::ending_permits_retry]), and for a cancellation; and a
retryable one for a line that exited non-zero or was ended by a signal
— carrying how the line ended, THAT line’s own standard error, what the
lines before it wrote to standard error, and everything the body had
printed before it stopped.
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