pub struct CommandHandler { /* private fields */ }Expand description
Command handler implementation.
IO protocol:
- stdin = JSON serialization of the step envelope, one line
- stdout = verdict JSON object (empty = no intervention), passed through to the engine as-is
- stderr = forwarded to tracing
- exit 0 = determined by stdout; non-zero =
HookError::HandlerFailed
Implementations§
Source§impl CommandHandler
impl CommandHandler
pub fn new(spec: CommandSpec) -> Self
Sourcepub fn timeout(&self) -> Option<Duration>
pub fn timeout(&self) -> Option<Duration>
The timeout configured on this handler. The CLI assembly forwards it into
StepHandlerEntry::with_timeout; the
engine applies its own default fallback when this is None.
Trait Implementations§
Source§impl StepHandler for CommandHandler
impl StepHandler for CommandHandler
Source§fn handle_step<'a>(
&'a self,
envelope: &'a Value,
ctx: HookCtx<'a>,
) -> BoxFuture<'a, Result<Option<Value>, HookError>>
fn handle_step<'a>( &'a self, envelope: &'a Value, ctx: HookCtx<'a>, ) -> BoxFuture<'a, Result<Option<Value>, HookError>>
Feeds the step envelope as JSON to the child process’s stdin; stdout is the verdict JSON (empty stdout means no intervention).
Simpler than the old handle — the envelope is already a Value, so no
CommandEventEnvelope conversion is needed. stdout is passed directly as the
verdict to the engine’s apply_verdict, and the IO protocol is reduced from
“parse into HookOutcome” to “pass JSON through as-is”.
Auto Trait Implementations§
impl Freeze for CommandHandler
impl RefUnwindSafe for CommandHandler
impl Send for CommandHandler
impl Sync for CommandHandler
impl Unpin for CommandHandler
impl UnsafeUnpin for CommandHandler
impl UnwindSafe for CommandHandler
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