pub struct Supervisor<M>where
M: ProcessMonitor + Send,{ /* private fields */ }
Expand description
A supervisor that manages a child process and its logging.
Implementations§
Source§impl<M> Supervisor<M>where
M: ProcessMonitor + Send,
impl<M> Supervisor<M>where
M: ProcessMonitor + Send,
Sourcepub fn new(
child_exe: impl Into<PathBuf>,
child_args: impl IntoIterator<Item = impl Into<String>>,
child_envs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
log_dir: impl Into<PathBuf>,
process_monitor: M,
) -> Self
pub fn new( child_exe: impl Into<PathBuf>, child_args: impl IntoIterator<Item = impl Into<String>>, child_envs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, log_dir: impl Into<PathBuf>, process_monitor: M, ) -> Self
Creates a new supervisor instance.
§Arguments
child_exe
- Path to the child executablechild_args
- Arguments to pass to the child executablelog_dir
- Path to the supervisor’s log directoryprocess_monitor
- The process monitor to usechild_envs
- Environment variables for the child process
Sourcepub async fn start(&mut self) -> MicrosandboxUtilsResult<()>
pub async fn start(&mut self) -> MicrosandboxUtilsResult<()>
Starts the supervisor and the child process.
This method:
- Creates the log directory if it doesn’t exist
- Starts the child process with appropriate IO (TTY or pipes)
- Passes the IO to the process monitor
Auto Trait Implementations§
impl<M> Freeze for Supervisor<M>where
M: Freeze,
impl<M> RefUnwindSafe for Supervisor<M>where
M: RefUnwindSafe,
impl<M> Send for Supervisor<M>
impl<M> Sync for Supervisor<M>where
M: Sync,
impl<M> Unpin for Supervisor<M>where
M: Unpin,
impl<M> UnwindSafe for Supervisor<M>where
M: UnwindSafe,
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