pub struct SpawnOptions {
pub cgroup_procs: Option<Arc<CString>>,
pub on_spawn: Option<Arc<dyn Fn(SpawnedProcess) + Send + Sync>>,
}Expand description
What the shell does with each external process it spawns, for an embedder that confines or tracks the processes its commands start. The default does nothing.
The options are part of the shell’s RuntimeOptions, so they reach every
external command the shell runs, pipelines, background jobs and subshells
included, since those copy the shell they run in.
Fields§
§cgroup_procs: Option<Arc<CString>>A file each child writes 0 to after it is forked and before it runs
its program. For a cgroup v2’s cgroup.procs file, the write moves
the child into that cgroup, so it cannot fork a process outside it;
only Linux has cgroups. When the child cannot open the file or write
to it, the command fails to execute and its program never runs.
on_spawn: Option<Arc<dyn Fn(SpawnedProcess) + Send + Sync>>Called with each child once it has started, before the shell waits for it. It runs on the shell’s task, so it should return quickly.
Trait Implementations§
Source§impl Clone for SpawnOptions
impl Clone for SpawnOptions
Source§impl Debug for SpawnOptions
impl Debug for SpawnOptions
Auto Trait Implementations§
impl !RefUnwindSafe for SpawnOptions
impl !UnwindSafe for SpawnOptions
impl Freeze for SpawnOptions
impl Send for SpawnOptions
impl Sync for SpawnOptions
impl Unpin for SpawnOptions
impl UnsafeUnpin for SpawnOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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