pub struct SignalGuard { /* private fields */ }Expand description
What: Owns the relaying handlers for its lifetime. Install one guard, run the Git child through it, then drop it after cleanup. Why: Dropping it restores the previous dispositions, so a signal after cleanup behaves as it did before.
In TS you’d write (pseudocode):
using guard = SignalGuard.install(); const outcome = await guard.runChild(command);Implementations§
Source§impl SignalGuard
Methods over an installed guard.
impl SignalGuard
Methods over an installed guard.
Sourcepub fn install() -> Result<Self>
pub fn install() -> Result<Self>
What: Install the relaying handlers. Fails when another guard is already active in this process. Why: The handlers are process-wide, so a second guard would record the first one’s handler as the old disposition.
In TS you’d write (pseudocode):
static install(): SignalGuard // throws when already installedSourcepub fn run_child(&self, command: &mut Command) -> Result<ChildOutcome>
pub fn run_child(&self, command: &mut Command) -> Result<ChildOutcome>
What:
Start command, wait for it while relaying signals, and return how it ended.
The guard does not exit the process; the caller releases its locks and removes its state, then exits.
Why:
Signals that arrived before the child started are relayed as soon as it has a PID.
In TS you’d write (pseudocode):
async runChild(command: SpawnOptions): Promise<ChildOutcome>Trait Implementations§
Source§impl Drop for SignalGuard
Available on Unix only.Restore the previous dispositions and release the process-wide slot.
impl Drop for SignalGuard
Restore the previous dispositions and release the process-wide slot.
Auto Trait Implementations§
impl Freeze for SignalGuard
impl RefUnwindSafe for SignalGuard
impl Send for SignalGuard
impl Sync for SignalGuard
impl Unpin for SignalGuard
impl UnsafeUnpin for SignalGuard
impl UnwindSafe for SignalGuard
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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