pub struct ScriptHook { /* private fields */ }Expand description
An operator-supplied script, and the budget it runs under.
Implementations§
Source§impl ScriptHook
impl ScriptHook
Sourcepub fn new(script_path: &str, args: &[String], timeout_ms: u64) -> Option<Self>
pub fn new(script_path: &str, args: &[String], timeout_ms: u64) -> Option<Self>
Builds a hook, or None when no script is configured.
Each subsystem words its own “you enabled this but gave no path” startup error, because only it knows which configuration key to name and what to tell the operator to remove.
Sourcepub async fn run(
&self,
envs: &[(&str, &str)],
stdin: ScriptStdin<'_>,
) -> Result<ScriptOutcome, ScriptError>
pub async fn run( &self, envs: &[(&str, &str)], stdin: ScriptStdin<'_>, ) -> Result<ScriptOutcome, ScriptError>
Runs the script with envs in an otherwise empty environment.
Sourcepub fn detail(outcome: &ScriptOutcome, noun: &str) -> String
pub fn detail(outcome: &ScriptOutcome, noun: &str) -> String
A one-line reason a script’s non-zero exit should be reported as.
First non-empty line of stdout, else of stderr, else the exit status — prefixed with the stdin failure when there was one, since a script that never received its payload failed for a completely different reason than one that read it and objected.
Trait Implementations§
Source§impl Clone for ScriptHook
impl Clone for ScriptHook
Auto Trait Implementations§
impl Freeze for ScriptHook
impl RefUnwindSafe for ScriptHook
impl Send for ScriptHook
impl Sync for ScriptHook
impl Unpin for ScriptHook
impl UnsafeUnpin for ScriptHook
impl UnwindSafe for ScriptHook
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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