pub struct SupervisedCmd { /* private fields */ }Expand description
A single child process, configured but not yet started.
Ported from overseer.NewCmd’s return value – narrowly, for the one
capability editmodeprocesssupervisor’s tests actually exercise on
it: streaming stdout line-by-line to a channel while the process runs,
then reporting whether it exited cleanly. overseer.NewCmd’s restart
bookkeeping, PID file, and Cmd.Stop/signal handling belong to
supervise_all’s orchestration layer (still not ported, see that
function’s doc comment) rather than to a single child’s lifecycle, so
they are not part of this struct.
Implementations§
Source§impl SupervisedCmd
impl SupervisedCmd
Sourcepub fn start(self) -> Result<(Receiver<String>, Receiver<CmdStatus>)>
pub fn start(self) -> Result<(Receiver<String>, Receiver<CmdStatus>)>
Port of overseer.Cmd.Start().
Spawns the child and returns immediately with a receiver that
yields each line of its combined stdout as it is produced, and a
second receiver that yields exactly one CmdStatus once the
child exits. Both channels are closed from a background thread
(mirroring overseer’s own internal goroutine) once the child has
finished and its output has been fully drained.
Unlike Go’s overseer.Cmd.Start, which returns a channel even on
spawn failure (closing Stdout immediately and sending a status
carrying the spawn error), this returns Err synchronously on
spawn failure, since Rust has no equivalent need to defer that
error onto a channel the caller must still drain.
§Errors
Returns an error if the child process fails to spawn.
§Panics
Panics if spawning succeeds but the child’s stdout was not piped,
which cannot happen since start always configures Stdio::piped().
Auto Trait Implementations§
impl Freeze for SupervisedCmd
impl RefUnwindSafe for SupervisedCmd
impl Send for SupervisedCmd
impl Sync for SupervisedCmd
impl Unpin for SupervisedCmd
impl UnsafeUnpin for SupervisedCmd
impl UnwindSafe for SupervisedCmd
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more