pub struct Supervisor { /* private fields */ }Expand description
Minimal PID-file supervision for long_running actions: start detached
in a fresh process group with output to a log file, record the PID, stop
by signaling the group. No daemon, no restart policy.
Implementations§
Source§impl Supervisor
impl Supervisor
Sourcepub fn new(state_dir: Utf8PathBuf) -> Self
pub fn new(state_dir: Utf8PathBuf) -> Self
state_dir is per instance: .newgit/state/<slug>/.
pub fn running_pid(&self, resource: &str) -> Option<u32>
pub fn start( &self, resource: &str, command: &str, cwd: &Utf8Path, env: &[(String, String)], log_path: &Utf8Path, ) -> Result<u32>
Sourcepub fn stop(&self, resource: &str, signal: &str) -> Result<StopOutcome>
pub fn stop(&self, resource: &str, signal: &str) -> Result<StopOutcome>
Signal the process group and wait up to ~5s for it to exit.
Sourcepub fn prune_dead_pids(&self, dry_run: bool) -> Result<Vec<Utf8PathBuf>>
pub fn prune_dead_pids(&self, dry_run: bool) -> Result<Vec<Utf8PathBuf>>
Remove PID files whose process group is gone — a process that died
on its own, or outlived a reboot. Returns what was removed, or what
would be under dry_run.
Trait Implementations§
Source§impl Clone for Supervisor
impl Clone for Supervisor
Source§fn clone(&self) -> Supervisor
fn clone(&self) -> Supervisor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Supervisor
impl RefUnwindSafe for Supervisor
impl Send for Supervisor
impl Sync for Supervisor
impl Unpin for Supervisor
impl UnsafeUnpin for Supervisor
impl UnwindSafe for Supervisor
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